[New-bugs-announce] [issue8752] set_contains, etc. should check for collections.Set in addition to PySet_Check
report at bugs.python.org
Tue May 18 17:21:12 CEST 2010
New submission from Daniel Stutzbach <daniel at stutzbachenterprises.com>:
For operations that test membership in a set, Python coerces sets and subclasses of set into a temporary frozenset before testing membership.
For example, this works:
>>> set() in set([frozenset()])
Although the set() is not hashable itself, Python creates a temporary frozenset() out of the set(). It should do the same for user-types derived from collections.Set, so they can inter-operate in the same way.
In setobject.c, the following methods behave in the described manner: set_contains, set_remove, and set_discard.
components: Interpreter Core
stage: unit test needed
title: set_contains, etc. should check for collections.Set in addition to PySet_Check
versions: Python 2.7, Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce