Nice hack!!! :-) :-) I think I'll use this as a *better* hack in many
cases, BUT it still does not quite achieve the intent of disposing of
an arbitrary return value. The problem is that sometimes the return
value is not "None", but still evaluates as "false". For example:
0 and None
prints 0 (oops). Hence for an *arbitrary* function,
f(x) and None
won't always go printless :-(. I could write a varargs program:
def trashit(*args):
return
and then I could always write:
trashit(f(x))
and I would have the most general hack.
Isn't it obvious that what is really needed is another statement in
Python? Note that all the suggestions I've seen or listed have
run-time costs (e.g., look up and invoke "ignore()"; look up and
evaluate "None", then perform an operation; lookup and invoke
"trashit()") ? I think your "and None" hack is the most efficient one
(no function invocation is needed), but it is also not general :-(.
Jim
Jim Roskind
408-982-4469
jar@infoseek.com