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

2010-08-24 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Committed as r84301, r84302, and r84305. -- keywords: -needs review stage: patch review - committed/rejected status: open - closed versions: -Python 2.6 ___ Python tracker

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

2010-08-22 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: The patch looks good. Feel free to apply. -- assignee: rhettinger - stutzbach ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8750

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

2010-08-21 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- assignee: stutzbach - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8750 ___

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

2010-05-23 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8750 ___

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

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Patch with unit test attached for MutableSet's: x ^= x x -= x I was wrong about |= and = having a problem. Since they don't mutate the set, they don't raise an exception (they only .add items that are already in the set).

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

2010-05-18 Thread Daniel Stutzbach
New submission from Daniel Stutzbach dan...@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

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

2010-05-18 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Here's a possible fix: def __isub__(self, it): if it is self: self.clear() else: for value in it: self.discard(value) return self -- nosy: +rhettinger versions: +Python 2.6,