New submission from Willi Richert <w.rich...@gmx.net>: 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, however, be some_set.get() The attached patch does this for set(). If this is accepted by the community, frozenset should be extended as well. ---------- components: Library (Lib) files: setobject_get.patch keywords: patch messages: 94508 nosy: wrichert severity: normal status: open title: Retrieve an arbitrary element from a set without removing it type: feature request versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file15207/setobject_get.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7212> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com