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

2010-08-24 Thread Daniel Stutzbach
Daniel Stutzbach 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-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: The patch looks good. Feel free to apply. -- assignee: rhettinger -> stutzbach ___ Python tracker ___ ___

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

2010-08-21 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: stutzbach -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

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

2010-05-23 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> accepted ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

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

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach 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). I added tests for them but left

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

2010-05-18 Thread Raymond Hettinger
Raymond Hettinger 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, Python 3.1 ___

[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 : 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