[issue22089] collections.MutableSet does not provide update method

2014-07-30 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> not a bug status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Guido van Rossum
Guido van Rossum added the comment: Oh the joy of duck typing. :-( If anything, set should be made to behave more like MutableSet by allowing arbitrary iterable arguments to the __i**__ methods. I do not think it is a good idea to add all of the named versions of the methods to the ABC (even

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: This is a bit of a pity, since the named methods are generally more explicit for non-experts than the operators. The ABC could simply define default implementations for those methods to fallback on the operators. By not providing such default implementations,

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: The starting point for this feature request should be recognizing that Guido intentionally chose to not implement the named methods. Excerpt from PEP 3119: "This also supports the in-place mutating operations |=, &=, ^=, -=. These are concrete methods whos

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Akira Li
Akira Li added the comment: On the other hand update() method may accept multiple iterables at once: def update(self, *iterables): for it in iterables: self |= it and therefore it is not equivalent to __ior__ method. In this case: 'difference', 'intersection', 'union' set meth

[issue22089] collections.MutableSet does not provide update method

2014-07-29 Thread Akira Li
Akira Li added the comment: Set has no __ior__ method but MutableSet has: class MySet(MutableSet): update = MutableSet.__ior__ Unlike set.__ior__; MutableSet.__ior__ accepts an arbitrary iterable and therefore MutableSet.update is redundant. set.__ior__ doesn't accept an arbitrary iter

[issue22089] collections.MutableSet does not provide update method

2014-07-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: Minor correction to example. That should be: class MySet(Set): update = Set.__ior__ (no paren after __ior__, since we're assigning, not calling) -- nosy: +josh.rosenberg ___ Python tracker

[issue22089] collections.MutableSet does not provide update method

2014-07-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: It's not a bug. Guido designed the Set ABC to use operators instead of the named methods. The += operator for the __ior__() method that provides much of the same functionality. In your concrete class, you can add an update() method easily: class MySe

[issue22089] collections.MutableSet does not provide update method

2014-07-28 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg224153 ___ Python tracker ___ ___ Python-bugs-list mailin

[issue22089] collections.MutableSet does not provide update method

2014-07-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: It's not a bug. Guido designed the Set ABC to use operators instead of the named methods. The += operator for the __iadd__() method that provides much of the same functionality. Mutable mapping has an update() method because it is an essential part of th

[issue22089] collections.MutableSet does not provide update method

2014-07-27 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue22089] collections.MutableSet does not provide update method

2014-07-26 Thread Roy Wellington
New submission from Roy Wellington: Inheriting from collections.MutableSet mixes in several methods, however, it does not mix in a .update method. This can cause a variety of confusion if you expect a MutableSet to act like a set. Moreover, MutableMapping does provide a .update method, which m