[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-02 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Committed to py3k in r84435. Raymond, do you want to look the commit over before I merge it into 3.1 and 2.7? -- ___ Python tracker rep...@bugs.python.org

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-02 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Meant to add: I made some relatively minor changes to Daniel Urban's patch. Mostly, I rearranged the order of a few things to avoid unnecessary work (e.g., only compute len_other if we've already checked that other is a

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-02 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Also, credited Daniel Urban for the patch in r84436 (forgot that the first time around -- sorry!). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9212

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-01 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Thanks for the corrections. I'm attaching the new patch as issue9212b.diff. I'm using PyAnySet_Check to determine if the other argument is really a set, but I'm not entirely sure, that this is correct. Please let me know if other

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-01 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: It would be nice to get this fixed before the next release. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9212 ___

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-09-01 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: I will aim to spend some time with this (and the similar Issue #9213) today and/or tomorrow, so that it can be committed in time for 3.2a2. -- resolution: - accepted stage: unit test needed - patch review

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-08-20 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: Thank you for the patch. We should only iterate over the shorter set if the longer set is really a set and not just a sequence. PySequence_Contains may take O(n) time on a list, making the algorithm an expensive O(n**2)

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-24 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: Unless there is a reason I have missed, I would iterate through the smaller set, which might even be empty or nearly so, rather than either in particular. You're right, here is a new patch. Pseudocode: def isdisjoint(self, other):

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-23 Thread Daniel Urban
Daniel Urban urban.dani...@gmail.com added the comment: The attached patch adds the isdisjoint method to dict_keys and dict_items. Pseudocode for the method: def isdisjoint(self, other): if self is other: if len(self) == 0: return True else: return

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-23 Thread Terry J. Reedy
Terry J. Reedy tjre...@udel.edu added the comment: Titles that fit in the box, like 'Dict.keys lacks .isjoint method.' are easier to read and keep track of. Unless there is a reason I have missed, I would iterate through the smaller set, which might even be empty or nearly so, rather than

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +merwok ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9212 ___ ___ Python-bugs-list mailing

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Concrete classes are allowed to have more features than the corresponding ABC. The ABCs are not intended to be full-featured; instead, they specify the part of the API that will be guaranteed. For example, the union()

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Daniel Stutzbach
Daniel Stutzbach dan...@stutzbachenterprises.com added the comment: In this case, the concrete class is the one missing a method. Concrete classes are allowed to provide more features than the corresponding ABC, but the converse is not true to the best of my knowledge. dict_keys

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I had misread you original post. Thought you we saying that the Set ABC was missing disjoint. Disregard my last post. -- ___ Python tracker rep...@bugs.python.org

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9212 ___

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-09 Thread Daniel Stutzbach
New submission from Daniel Stutzbach dan...@stutzbachenterprises.com: isinstance({}.keys(), collections.Set) True [method for method in set(dir(collections.Set)) - set(dir({}.keys())) ... if not method.startswith('_')] ['isdisjoint'] (in Python 2.7, use viewkeys() instead of keys)

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach dan...@stutzbachenterprises.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9212 ___ ___