diff options
author | Raymond Hettinger <python@rcn.com> | 2008-01-28 20:34:33 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-01-28 20:34:33 (GMT) |
commit | ecdcb5895029c83c8bb5f98de502beaa56b78c9e (patch) | |
tree | 92e2ac58fc2e7f4d2d1e0514ba3a26c4adbad6af /Doc | |
parent | 99120c4f7ea621ba2386c11d1300da335853dd68 (diff) | |
download | cpython-ecdcb5895029c83c8bb5f98de502beaa56b78c9e.zip cpython-ecdcb5895029c83c8bb5f98de502beaa56b78c9e.tar.gz cpython-ecdcb5895029c83c8bb5f98de502beaa56b78c9e.tar.bz2 |
Make PySet_Add() work with frozensets.
Works like PyTuple_SetItem() to build-up values in a brand new frozenset.
Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/set.rst | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Doc/c-api/set.rst b/Doc/c-api/set.rst index e677c05..2ed93e9 100644 --- a/Doc/c-api/set.rst +++ b/Doc/c-api/set.rst @@ -86,6 +86,11 @@ the constructor functions work with any iterable Python object. set on success or *NULL* on failure. Raise :exc:`TypeError` if *iterable* is not actually iterable. + .. versionchanged:: 2.6 + Now guaranteed to return a brand-new :class:`frozenset`. Formerly, + frozensets of zero-length were a singleton. This got in the way of + building-up new frozensets with :meth:`PySet_Add`. + The following functions and macros are available for instances of :class:`set` or :class:`frozenset` or instances of their subtypes. @@ -112,9 +117,6 @@ or :class:`frozenset` or instances of their subtypes. the *key* is unhashable. Raise :exc:`PyExc_SystemError` if *anyset* is not a :class:`set`, :class:`frozenset`, or an instance of a subtype. -The following functions are available for instances of :class:`set` or its -subtypes but not for instances of :class:`frozenset` or its subtypes. - .. cfunction:: int PySet_Add(PyObject *set, PyObject *key) @@ -124,6 +126,14 @@ subtypes but not for instances of :class:`frozenset` or its subtypes. Raise a :exc:`SystemError` if *set* is an not an instance of :class:`set` or its subtype. + .. versionchanged:: 2.6 + Now works with instances of :class:`frozenset` or its subtypes. + Like :cfunc:`PyTuple_SetItem` in that it can be used to fill-in the + values of brand new frozensets before they are exposed to other code. + +The following functions are available for instances of :class:`set` or its +subtypes but not for instances of :class:`frozenset` or its subtypes. + .. cfunction:: int PySet_Discard(PyObject *set, PyObject *key) |