preferring  or () in list of error codes?
ben+python at benfinney.id.au
Mon Jun 8 23:43:08 EDT 2009
Steven D'Aprano <steven at REMOVE.THIS.cybersource.com.au> writes:
> In addition, using a tuple or a list in this context:
> if e.message.code in (25401,25402,25408):
> is so idiomatic, that using a set in it's place would be distracting.
I think a list in that context is fine, and that's the idiom I see far
more often than a tuple.
> Rather that efficiently communicating the programmer's intention, it
> would raise in my mind the question "that's strange, why are they
> using a set there instead of a tuple?".
The fact that literal set syntax is a relative newcomer is the primary
reason for that, I'd wager.
\ “If you are unable to leave your room, expose yourself in the |
`\ window.” —instructions in case of fire, hotel, Finland |
More information about the Python-list