[issue27937] logging.getLevelName microoptimization
R. David Murray
report at bugs.python.org
Fri Sep 2 11:03:02 EDT 2016
R. David Murray added the comment:
Parens do not cause lazy evaluation unless what is parenthesized is a generator comprehension. An expanded if solution is the correct one.
If Vinay prefers a one liner, I think you could also write:
_levelToName.get(level) or _nameToLevel.get(level) or ("Level %s" % level)
Because we know we get back either a True string or None, I don't think there's any ambiguity there.
----------
nosy: +r.david.murray, vinay.sajip
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27937>
_______________________________________
More information about the Python-bugs-list
mailing list