New submission from Daniel Stutzbach <dan...@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()])
True

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
messages: 105983
nosy: stutzbach
priority: normal
severity: normal
stage: unit test needed
status: open
title: set_contains, etc. should check for collections.Set in addition to 
PySet_Check
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8752>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to