Re: Tossing return values from functions (without -k option or printing)

Tim Peters (tim@ksr.com)
Fri, 01 Apr 94 20:14:38 EST

Jim, it's very hard to make you happy when you insist on purity in one
msg and speed in the next <wink>.

> > [f(x)] and None
> > [never prints unless f itself does]

> Well, you used to have the faster hack method of doing it, but now...
> [explains that the above ain't cheap]

Right! That was the elegant answer. The fast answer is one you already
mentioned (spelling changed to make C weenies feel at home):

void = f(x)

Local variable references resolve to a fixed (C) array index _at compile
time_, so assignments to locals are among the cheapest things you can do
in Python. Time some actual programs.

> ...
> As I said, the obvious answer is a new statement.

If Guido wants to do that, I already said it's fine by me, but you're not
going to succeed in convincing me _I_ have a problem with void'ing return
values <wink>.

> ...but perchance this is a stylistic question of whether you like
> obfuscating hacks in your code or not (sarcastic double <g>).

The only time I've had a problem with this is when doing
os.system(cmd_string), and then I'm quite happy doing

junk = os.system(cmd_string)

You may not like that, but I don't think it's bad enough to charge me
with First-Degree Obfuscation ...

Helpful Hint: If you really want to "solve" this, you'll need to suggest
a specific alternative and then sell it. For a variety of reasons, Guido
almost never accepts proposals for new statements ("global" and "access"
are the only ones that succeeded in my tenure, & the former happened
years ago while the latter remains unimplemented). So I bet a command-
line option and/or sys.something flag would have a much better chance of
succeeding.

voidedly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp