Author John Belmonte
Recipients John Belmonte, Manjusaka, ethan.furman, veky
Date 2020-10-11.14:24:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602426255.05.0.97296464738.issue38250@roundup.psfhosted.org>
In-reply-to
Content
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__()`.
History
Date User Action Args
2020-10-11 14:24:15John Belmontesetrecipients: + John Belmonte, ethan.furman, veky, Manjusaka
2020-10-11 14:24:15John Belmontesetmessageid: <1602426255.05.0.97296464738.issue38250@roundup.psfhosted.org>
2020-10-11 14:24:14John Belmontelinkissue38250 messages
2020-10-11 14:24:14John Belmontecreate