Willi Richert added the comment:
No particular reason, besides that it is ripped off of pop().
Your solution (omitting "register") gives the same performance. Looks
cleaner, of course.
The patch tries to provide a clean way of "for x in some_set: break", as
explained a
Willi Richert added the comment:
added tests for get() to test_set.py
--
___
Python tracker
<http://bugs.python.org/issue7212>
___
___
Python-bugs-list mailin
Changes by Willi Richert :
Added file: http://bugs.python.org/file15211/setobject_get.patch
___
Python tracker
<http://bugs.python.org/issue7212>
___
___
Python-bug
Changes by Willi Richert :
Removed file: http://bugs.python.org/file15207/setobject_get.patch
___
Python tracker
<http://bugs.python.org/issue7212>
___
___
Python-bug
New submission from Willi Richert :
Sometimes, a non-removing pop() is needed. In current Python versions,
it can achieved by one of the following ways:
1.
x = some_set.pop()
some_set.add(x)
2.
for x in some_set:
break
3.
x = iter(some_set).next()
More native and clean would