Message85006
The current MutableSet.__iand__ implementation calls self.discard while
iterating on self. This creates strange problems while implementing
MutableSet with simple choices. For example, consider the attached file
which implements set by delegating either to a set or a list. In the
first cases, an exception is raised; in the second, the result is not
what is expected.
Python 2.6+ (r26:66714, Oct 22 2008, 09:21:39)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from simpleset import WithSet, WithList
>>> s = WithSet([1,2])
>>> s &= ()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/_abcoll.py", line 290, in __iand__
for value in self:
RuntimeError: Set changed size during iteration
>>> s = WithList([1,2])
>>> s &= ()
>>> list(s)
[2] |
|
Date |
User |
Action |
Args |
2009-04-01 13:43:22 | della | set | recipients:
+ della |
2009-04-01 13:43:22 | della | set | messageid: <1238593402.02.0.427774935909.issue5647@psf.upfronthosting.co.za> |
2009-04-01 13:43:20 | della | link | issue5647 messages |
2009-04-01 13:43:20 | della | create | |
|