[issue27935] logging level FATAL missing in _nameToLevel

2016-09-03 Thread Ondřej Medek
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

[issue27937] logging.getLevelName microoptimization

2016-09-02 Thread Ondřej Medek
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

[issue27937] logging.getLevelName microoptimization

2016-09-02 Thread Ondřej Medek
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

[issue27937] logging.getLevelName microoptimization

2016-09-02 Thread Ondřej Medek
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

[issue27935] logging level FATAL missing in _nameToLevel

2016-09-01 Thread Ondřej Medek
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