[Python-checkins] r56829 - in doctools/trunk: Doc-26/library/functions.rst Doc-26/library/stdtypes.rst Doc-3k/library/functions.rst Doc-3k/library/stdtypes.rst
georg.brandl
python-checkins at python.org
Wed Aug 8 14:07:33 CEST 2007
Author: georg.brandl
Date: Wed Aug 8 14:07:32 2007
New Revision: 56829
Modified:
doctools/trunk/Doc-26/library/functions.rst
doctools/trunk/Doc-26/library/stdtypes.rst
doctools/trunk/Doc-3k/library/functions.rst
doctools/trunk/Doc-3k/library/stdtypes.rst
Log:
Document set constructors in stdtypes.
Modified: doctools/trunk/Doc-26/library/functions.rst
==============================================================================
--- doctools/trunk/Doc-26/library/functions.rst (original)
+++ doctools/trunk/Doc-26/library/functions.rst Wed Aug 8 14:07:32 2007
@@ -234,6 +234,7 @@
The complex type is described in :ref:`typesnumeric`.
+
.. function:: delattr(object, name)
This is a relative of :func:`setattr`. The arguments are an object and a
@@ -245,10 +246,11 @@
.. function:: dict([arg])
:noindex:
- Create a new data dictionary. The dictionary type is described in
- :ref:`typesmapping`. For other containers see the built in
- :class:`list`, :class:`set`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ Create a new data dictionary, optionally with items taken from *arg*.
+ The dictionary type is described in :ref:`typesmapping`.
+
+ For other containers see the built in :class:`list`, :class:`set`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. function:: dir([object])
@@ -451,17 +453,13 @@
The float type is described in :ref:`typesnumeric`.
.. function:: frozenset([iterable])
+ :noindex:
- Return a frozenset object whose elements are taken from *iterable*. Frozensets
- are sets that have no update methods but can be hashed and used as members of
- other sets or as dictionary keys. The elements of a frozenset must be immutable
- themselves. To represent sets of sets, the inner sets should also be
- :class:`frozenset` objects. If *iterable* is not specified, returns a new empty
- set, ``frozenset([])``.
-
- The frozenset type is described in :ref:`types-set`. For other containers see the built in
- :class:`dict`, :class:`list`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ Return a frozenset object, optionally with elements taken from *iterable*.
+ The frozenset type is described in :ref:`types-set`.
+
+ For other containers see the built in :class:`dict`, :class:`list`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. versionadded:: 2.4
@@ -990,15 +988,13 @@
.. function:: set([iterable])
+ :noindex:
+
+ Return a new set, optionally with elements are taken from *iterable*.
+ The set type is described in :ref:`types-set`.
- Return a set whose elements are taken from *iterable*. The elements must be
- immutable. To represent sets of sets, the inner sets should be
- :class:`frozenset` objects. If *iterable* is not specified, returns a new empty
- set, ``set([])``.
-
- The set type is described in :ref:`types-set`. For other containers see the built in
- :class:`dict`, :class:`list`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ For other containers see the built in :class:`dict`, :class:`list`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. versionadded:: 2.4
Modified: doctools/trunk/Doc-26/library/stdtypes.rst
==============================================================================
--- doctools/trunk/Doc-26/library/stdtypes.rst (original)
+++ doctools/trunk/Doc-26/library/stdtypes.rst Wed Aug 8 14:07:32 2007
@@ -1428,8 +1428,18 @@
like :meth:`add` and :meth:`remove`. Since it is mutable, it has no hash value
and cannot be used as either a dictionary key or as an element of another set.
The :class:`frozenset` type is immutable and hashable --- its contents cannot be
-altered after is created; however, it can be used as a dictionary key or as an
-element of another set.
+altered after it is created; it can therefore be used as a dictionary key or as
+an element of another set.
+
+The constructors for both classes work the same:
+
+.. class:: set([iterable])
+ frozenset([iterable])
+
+ Return a new set or frozenset object whose elements are taken from
+ *iterable*. The elements of a set must be hashable. To represent sets of
+ sets, the inner sets must be :class:`frozenset` objects. If *iterable* is
+ not specified, a new empty set is returned.
Instances of :class:`set` and :class:`frozenset` provide the following
operations:
Modified: doctools/trunk/Doc-3k/library/functions.rst
==============================================================================
--- doctools/trunk/Doc-3k/library/functions.rst (original)
+++ doctools/trunk/Doc-3k/library/functions.rst Wed Aug 8 14:07:32 2007
@@ -233,6 +233,7 @@
The complex type is described in :ref:`typesnumeric`.
+
.. function:: delattr(object, name)
This is a relative of :func:`setattr`. The arguments are an object and a
@@ -244,10 +245,11 @@
.. function:: dict([arg])
:noindex:
- Create a new data dictionary. The dictionary type is described in
- :ref:`typesmapping`. For other containers see the built in
- :class:`list`, :class:`set`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ Create a new data dictionary, optionally with items taken from *arg*.
+ The dictionary type is described in :ref:`typesmapping`.
+
+ For other containers see the built in :class:`list`, :class:`set`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. function:: dir([object])
@@ -482,17 +484,13 @@
The float type is described in :ref:`typesnumeric`.
.. function:: frozenset([iterable])
+ :noindex:
- Return a frozenset object whose elements are taken from *iterable*. Frozensets
- are sets that have no update methods but can be hashed and used as members of
- other sets or as dictionary keys. The elements of a frozenset must be immutable
- themselves. To represent sets of sets, the inner sets should also be
- :class:`frozenset` objects. If *iterable* is not specified, returns a new empty
- set, ``frozenset([])``.
-
- The frozenset type is described in :ref:`types-set`. For other containers see the built in
- :class:`dict`, :class:`list`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ Return a frozenset object, optionally with elements taken from *iterable*.
+ The frozenset type is described in :ref:`types-set`.
+
+ For other containers see the built in :class:`dict`, :class:`list`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. versionadded:: 2.4
@@ -921,15 +919,13 @@
.. function:: set([iterable])
+ :noindex:
+
+ Return a new set, optionally with elements are taken from *iterable*.
+ The set type is described in :ref:`types-set`.
- Return a set whose elements are taken from *iterable*. The elements must be
- immutable. To represent sets of sets, the inner sets should be
- :class:`frozenset` objects. If *iterable* is not specified, returns a new empty
- set, ``set([])``.
-
- The set type is described in :ref:`types-set`. For other containers see the built in
- :class:`dict`, :class:`list`, and :class:`tuple` classes, and the
- :mod:`collections` module.
+ For other containers see the built in :class:`dict`, :class:`list`, and
+ :class:`tuple` classes, and the :mod:`collections` module.
.. versionadded:: 2.4
Modified: doctools/trunk/Doc-3k/library/stdtypes.rst
==============================================================================
--- doctools/trunk/Doc-3k/library/stdtypes.rst (original)
+++ doctools/trunk/Doc-3k/library/stdtypes.rst Wed Aug 8 14:07:32 2007
@@ -1418,8 +1418,18 @@
like :meth:`add` and :meth:`remove`. Since it is mutable, it has no hash value
and cannot be used as either a dictionary key or as an element of another set.
The :class:`frozenset` type is immutable and hashable --- its contents cannot be
-altered after is created; however, it can be used as a dictionary key or as an
-element of another set.
+altered after it is created; it can therefore be used as a dictionary key or as
+an element of another set.
+
+The constructors for both classes work the same:
+
+.. class:: set([iterable])
+ frozenset([iterable])
+
+ Return a new set or frozenset object whose elements are taken from
+ *iterable*. The elements of a set must be hashable. To represent sets of
+ sets, the inner sets must be :class:`frozenset` objects. If *iterable* is
+ not specified, a new empty set is returned.
Instances of :class:`set` and :class:`frozenset` provide the following
operations:
More information about the Python-checkins
mailing list