[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue8743] set() operators don't work with collections.Set instances

2014-05-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset cd8b5b5b6356 by Raymond Hettinger in branch '3.4': Issue 8743: Improve interoperability between sets and the collections.Set abstract base class. http://hg.python.org/cpython/rev/cd8b5b5b6356 -- ___ Pyth

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3615cdb3b86d by Raymond Hettinger in branch '2.7': Issue 8743: Improve interoperability between sets and the collections.Set abstract base class. http://hg.python.org/cpython/rev/3615cdb3b86d -- nosy: +python-dev _

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Added tests that include the pure python sets.Set(). Only the binary or/and/sub/xor methods are tested. The comparison operators were designed to only interact with their own kind. A comment from Tim Peters explains the decision raise a TypeError inste

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Adding tests for non-set iterables as suggested by Serhiy. -- Added file: http://bugs.python.org/file35353/fix_set_abc2.diff ___ Python tracker __

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- versions: +Python 2.7, Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, interesting - I completely missed the comparison operators in my patch and tests. Your version looks good to me, though. That looks like a patch against 2.7 - do you want to add 2.7 & 3.4 back to the list of target versions for the fix? --

[issue8743] set() operators don't work with collections.Set instances

2014-05-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Attaching a draft patch with tests. -- Added file: http://bugs.python.org/file35346/fix_set_abc.diff ___ Python tracker ___ __

[issue8743] set() operators don't work with collections.Set instances

2014-03-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the patch update. I will look at it shortly. -- ___ Python tracker ___ ___ Python-bugs

[issue8743] set() operators don't work with collections.Set instances

2014-03-19 Thread Nick Coghlan
Nick Coghlan added the comment: This didn't make it into 3.4, and the comment about needing a porting note above still applies, so to 3.5 it goes. -- priority: high -> normal versions: +Python 3.5 -Python 3.4 ___ Python tracker

[issue8743] set() operators don't work with collections.Set instances

2014-02-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think set operations with iterable (but not set) should be tested. -- ___ Python tracker ___ ___

[issue8743] set() operators don't work with collections.Set instances

2014-02-02 Thread Nick Coghlan
Nick Coghlan added the comment: I initially missed Mark's suggestion above to avoid the recursive subtraction operation in __rsub__. v2 of my patch includes that tweak. -- Added file: http://bugs.python.org/file33864/issue8743-set-ABC-interoperability_v2.diff _

[issue8743] set() operators don't work with collections.Set instances

2014-02-02 Thread Nick Coghlan
Nick Coghlan added the comment: I updated the patch to apply cleanly to the default branch. I also added several new test cases which uncovered issues with Daniel's previous patch. Specifically: - the reverse functions were not be tested properly (added a separate test to ensure they all retu

[issue8743] set() operators don't work with collections.Set instances

2014-01-31 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue8743] set() operators don't work with collections.Set instances

2014-01-04 Thread Nick Coghlan
Nick Coghlan added the comment: Raymond, will you have a chance to look at this before 3.4rc1? Otherwise I'd like to take it. -- ___ Python tracker ___ __

[issue8743] set() operators don't work with collections.Set instances

2013-11-27 Thread Martin Dengler
Changes by Martin Dengler : -- nosy: +mdengler ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue8743] set() operators don't work with collections.Set instances

2013-05-21 Thread Nick Coghlan
Nick Coghlan added the comment: Armin pointed out in http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ that one nasty consequence of the remaining part of issue 2226 and this bug is making it much harder than it should be to use the ItemsView, KeysView and ValuesView from collectio

[issue8743] set() operators don't work with collections.Set instances

2013-05-20 Thread Nick Coghlan
Changes by Nick Coghlan : -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue8743] set() operators don't work with collections.Set instances

2012-10-31 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: stutzbach -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue8743] set() operators don't work with collections.Set instances

2012-10-31 Thread Andrew Svetlov
Changes by Andrew Svetlov : -- nosy: +asvetlov ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue8743] set() operators don't work with collections.Set instances

2012-10-31 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Heads up, Issue #16373. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue8743] set() operators don't work with collections.Set instances

2012-10-31 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue8743] set() operators don't work with collections.Set instances

2012-10-31 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue8743] set() operators don't work with collections.Set instances

2012-03-14 Thread Mark Shannon
Mark Shannon added the comment: Review of set-with-Set.patch: Looks good overall. I agree that restricting operations to instances of Set rather than Iterable is correct. Implementing "__rsub__" in terms of - (subtraction) means that infinite recursion is a possibility. It also creates an u

[issue8743] set() operators don't work with collections.Set instances

2011-08-18 Thread Meador Inge
Changes by Meador Inge : -- resolution: accepted -> stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mai

[issue8743] set() operators don't work with collections.Set instances

2011-06-26 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.3 -Python 3.1 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8743] set() operators don't work with collections.Set instances

2011-06-12 Thread Terry J. Reedy
Terry J. Reedy added the comment: If the code were acting exactly as documented, I would consider this a feature request. But "require that the parameter also be an instance of set()" (from original message) is too limited. >>> set() | frozenset() set() So 'set' in "their operator based coun

[issue8743] set() operators don't work with collections.Set instances

2011-01-26 Thread David Stanek
Changes by David Stanek : -- nosy: +dstanek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue8743] set() operators don't work with collections.Set instances

2010-12-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Would it be sufficient to: 1) Restrict collections.Set()'s operators to accept collection.Set but not arbitrary iterables, and 2) Fix Issue2226 and let set() | MySimpleSet() work via collections.Set.__ror__ Attached is a patch that implements this approach,

[issue8743] set() operators don't work with collections.Set instances

2010-12-01 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +durban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue8743] set() operators don't work with collections.Set instances

2010-11-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: No need to rush this for the beta. It's a bug fix and can go in at any time. The important thing is that we don't break the C code. The __ror__ magic method would still need to do the right thing and the C code needs to defend against the interpreter sw

[issue8743] set() operators don't work with collections.Set instances

2010-11-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, I can take a stab at it. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue8743] set() operators don't work with collections.Set instances

2010-11-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: Daniel, do you have time to work on this one? If so, go ahead an make setobject.c accept any instance of collections.Set and make the corresponding change to the ABCs: def __or__(self, other): if not isinstance(other, Set): return N

[issue8743] set() operators don't work with collections.Set instances

2010-11-29 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg117005 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8743] set() operators don't work with collections.Set instances

2010-09-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: After discussion on IRC, have decided to make the Set ABC more closely match setobject.c by loosening setobject.c binary operations to accept any Iterable rather than any just a set/frozenset. -- ___ Python trac

[issue8743] set() operators don't work with collections.Set instances

2010-09-20 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg116998 ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8743] set() operators don't work with collections.Set instances

2010-09-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: After discussion on IRC, have decided to make the Set ABC more closely match setobject.c: 1) loosen setobject.c binary operations to accept any Set rather than any set/frozenset (see attached patch). 2) tighten Set.__or__, etc to only accept Set rather th

[issue8743] set() operators don't work with collections.Set instances

2010-09-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: Rough cut at a first patch is attached. Still thinking about whether Set operations should be accepting any iterable or whether they should be tightened to expect other Set instances. The API for set() came from set.py which was broadly discussed and wide

[issue8743] set() operators don't work with collections.Set instances

2010-09-01 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: > The operator methods in setobject.c should be liberalized to accept > instances of collections.Set as arguments. Under this plan, set() and collections.Set will still have slightly different behavior. collections.Set will be more liberal and accept any it

[issue8743] set() operators don't work with collections.Set instances

2010-09-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: The operator methods in setobject.c should be liberalized to accept instances of collections.Set as arguments. For speed, they should continue to check PyAnySet_Check(other) first and then if that fails, fall back to testing PyObject_IsInstance(other, col

[issue8743] set() operators don't work with collections.Set instances

2010-09-01 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Raymond, do you agree with Ray's analysis? -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue8743] set() operators don't work with collections.Set instances

2010-08-22 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue8743] set() operators don't work with collections.Set instances

2010-08-22 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- priority: normal -> high ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue8743] set() operators don't work with collections.Set instances

2010-08-02 Thread Ray.Allen
Ray.Allen added the comment: In my opinion, the set's operator should be a bit more liberal and accept any collections.Set instances. Given collections.Set is an ABC and isinstance(set, collections.Set) is True, the set methods should(strong recommended) follow all the generalized abstract se

[issue8743] set() operators don't work with collections.Set instances

2010-08-01 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:

[issue8743] set() operators don't work with collections.Set instances

2010-08-01 Thread Guido van Rossum
Guido van Rossum added the comment: No idea, I don't even know what collections.Set is. :-( -- assignee: gvanrossum -> ___ Python tracker ___ ___

[issue8743] set() operators don't work with collections.Set instances

2010-08-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Guido, do you have a recommendation? -- assignee: rhettinger -> gvanrossum nosy: +gvanrossum ___ Python tracker ___ _

[issue8743] set() operators don't work with collections.Set instances

2010-07-31 Thread Georg Brandl
Changes by Georg Brandl : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue8743] set() operators don't work with collections.Set instances

2010-05-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I should add: I discovered the inconsistency while working on my sortedset class, which provides the same interface as set() but is also indexable like a list (e.g., S[0] always returns the minimum element, S[-1] returns the maximum element, etc.). sorted

[issue8743] set() operators don't work with collections.Set instances

2010-05-17 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The set() operators (__or__, __and__, __sub__, __xor__, and their in-place counterparts) require that the parameter also be an instance of set(). They're documented that way: "This precludes error-prone constructions like set('abc') & 'cbs' in favor of