New submission from Raymond Hettinger <raymond.hettin...@gmail.com>:
The dir() listing omits the attributes "description" and "phrase": >>> import http >>> from pprint import pp >>> r = http.HTTPStatus(404) >>> pp(vars(r)) {'_value_': 404, 'phrase': 'Not Found', 'description': 'Nothing matches the given URI', '_name_': 'NOT_FOUND', '__objclass__': <enum 'HTTPStatus'>} >>> r.value 404 >>> r.name 'NOT_FOUND' >>> r.description 'Nothing matches the given URI' >>> r.phrase 'Not Found' >>> dir(r) ['__class__', '__doc__', '__module__', 'as_integer_ratio', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'name', 'numerator', 'real', 'to_bytes', 'value'] One fix would be to teach IntEnum.__dir__() to include entries in the instance dict. Another fix would be to provide a way for a IntEnum subclass to add to the known members list. ---------- components: Library (Lib) messages: 365138 nosy: ethan.furman, rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: HTTPStatus has incomplete dir() listing type: behavior versions: Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40084> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com