New submission from Andrew Svetlov <andrew.svet...@gmail.com>:

Construction enums by-value (e.g. http.HTTPStatus(200)) performs two dict 
lookups: 
    if value in cls._value2member_map_:
        return cls._value2member_map_[value]

Changing the code to just
    return cls._value2member_map_[value]
with catching KeyError can speedup the fast path a little.

----------
components: Library (Lib)
messages: 332524
nosy: asvetlov
priority: normal
severity: normal
status: open
title: Speedup Enum lookup
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35585>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to