assignment expression peeve

Paul Rubin http
Wed Oct 15 01:19:07 EDT 2003


Ben Finney <bignose-hates-spam at and-benfinney-does-too.id.au> writes:
> If you want to do lots of different things, you really should be placing
> them in different functions:

Yeah, I mentioned I could do something like that, but that it was
overkill for such a small list.  Really, anywhere you have an
if/elif/elif/elif chain of any kind, you can probably replace it with
a lookup table.  But the if/elif/elif idiom exists because a lot of
the time, it's the most natural and clear and correct way to write the
code.  And this is just an obvious one of those instances, except it's
thwarted by a Python language deficiency that I hope will get
corrected someday.




More information about the Python-list mailing list