Message358742
Also, do we need to leave compatibility with python <3.8?
If not, we could use the fact that python 3.8 dicts and sets which are preserve order to speed things up even more. Also I'd replace % string formatting with f-strings, as they also faster.
And another thing to think about: maybe we can calculate values returned by __str__, __repr__ and __invert__ once on member creation, since they not supposed to change during its life?
For example __invert__ on Flag does a lot of work on every call:
def __invert__(self):
cls = self.__class__
members, uncovered = _decompose(cls, self._value_)
inverted = cls(0)
for m in cls:
if m not in members and not (m._value_ & self._value_):
inverted = inverted | m
return cls(inverted) |
|
Date |
User |
Action |
Args |
2019-12-20 22:59:56 | MrMrRobat | set | recipients:
+ MrMrRobat, barry, eli.bendersky, ethan.furman, levkivskyi |
2019-12-20 22:59:56 | MrMrRobat | set | messageid: <1576882796.22.0.410196922217.issue39102@roundup.psfhosted.org> |
2019-12-20 22:59:56 | MrMrRobat | link | issue39102 messages |
2019-12-20 22:59:56 | MrMrRobat | create | |
|