[New-bugs-announce] [issue8750] Many of MutableSet's methods assume that the other parameter is not self

Daniel Stutzbach report at bugs.python.org
Tue May 18 15:44:22 CEST 2010


New submission from Daniel Stutzbach <daniel at stutzbachenterprises.com>:

For example, here is one of MutableSet's methods:

    def __isub__(self, it):
        for value in it:
            self.discard(value)
        return self

However, if I do "x -= x", then it mutates my set-like object during iteration, which even the built-in set does not support.  ior, iand, and ixor have the same problem.

I'm working on running test_set.py (with suitable modifications) on my class that derives from collections.MutableSet, so I'm going to be bumping into all kinds of fun problems like this.

I'm going to override the methods in my class, and I can contribute my new methods back to Python as a patch once they're working.

----------
assignee: stutzbach
components: Library (Lib)
messages: 105974
nosy: stutzbach
priority: normal
severity: normal
stage: unit test needed
status: open
title: Many of MutableSet's methods assume that the other parameter is not self
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8750>
_______________________________________


More information about the New-bugs-announce mailing list