Ondřej Medek added the comment:
Just a comment to the https://hg.python.org/cpython/rev/85f9f8bf2ec8
It's functionality is right. It's just a little bit weird, that two derived
levels in _nameToLevel: 'FATAL' maps to FATAL, i.e. itself, while 'WARN' maps
to the W
Ondřej Medek added the comment:
That's probably my lack of Python knowledge. I have though that parentheses in
("Level %s" % level) cause lazy evaluation. If not, then this code has to be
optimized by if-then, too.
--
___
Python
Ondřej Medek added the comment:
Which 'first' method do you mean?
logging.getLevelName() converts level (int) to level name (str). But due to the
backward compatibility is also converts level name (str) to level (int).
--
___
Python trac
New submission from Ondřej Medek:
The logging.getLevelName contains code:
return _levelToName.get(level, _nameToLevel.get(level, ("Level %s" % level)))
I am still a Python beginner, but I think the most of the times the
_nameToLevel.get is called unnecessarily. IMHO the code should
New submission from Ondřej Medek:
logging.__init__._nameToLevel is missing 'FATAL' key:
>>> logging.getLevelName('FATAL')
'Level FATAL'
Expected same as:
>>> logging.getLevelName('CRITICAL')
50
------
components: Library (Lib)
mes