Handling 3 operands in an expression without raising an exception
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sun Sep 29 05:48:16 EDT 2013
On Sun, 29 Sep 2013 12:35:17 +0300, Jussi Piitulainen wrote:
> try:
> ...
> except socket.gaierror as e:
> # watch out, a composition of bad advice (on demand) city, host = (
> ('city' in locals() or "blabla"),
> ('host' in locals() or "blablabla") )
Bad advice, and buggy as well.
py> city = "New New York"
py> ('city' in locals() or "Blah blah")
True
Oh man, can you imagine Nikos trying to debug that?
--
Steven
More information about the Python-list
mailing list