John Belmonte <j...@neggie.net> added the comment:
Part of this issue (#1) was intended to be addressed by https://github.com/python/cpython/pull/22221 which added an `__iter__` implementation to Flag and IntFlag. (The PR did not reference this issue, and was already merged last month.) However that PR seems problematic on several counts: 1. `__iter__` diverges from the existing `__contains__`. The latter includes 0 and compound values 2. the implementation is fairly heavy 3. len() on an enum instance is going to be O(n) I've put post-merge comments on the PR. I think it would be safer to have an explicitly named `bits()` iterator on flag instances, rather than use `__iter__()`. ---------- keywords: +patch message_count: 3.0 -> 4.0 pull_requests: +21621 stage: -> patch review versions: +Python 3.10 -Python 3.9 pull_request: https://github.com/python/cpython/pull/22221 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38250> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com