summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-10-24 20:06:56 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-10-24 20:06:56 (GMT)
commite6c0f0d94aa460388cf58a3a6c146b6c4117d1fd (patch)
treeec915440ca8cbce83ba264d3c72bbf32a000fa8a /Doc
parentf0ef7fea901ba67068f4274a56c7154d462dc8ab (diff)
parent837cd06d36f7e69fc51e5bce7631041161f9b864 (diff)
downloadcpython-e6c0f0d94aa460388cf58a3a6c146b6c4117d1fd.zip
cpython-e6c0f0d94aa460388cf58a3a6c146b6c4117d1fd.tar.gz
cpython-e6c0f0d94aa460388cf58a3a6c146b6c4117d1fd.tar.bz2
#16210: merge with 3.2.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/functions.rst26
1 files changed, 11 insertions, 15 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index ae49cc2..0fb48f4 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1323,29 +1323,25 @@ are always available. They are listed here in alphabetical order.
.. function:: type(object)
+ type(name, bases, dict)
.. index:: object: type
- Return the type of an *object*. The return value is a type object and
- generally the same object as returned by ``object.__class__``.
+
+ With one argument, return the type of an *object*. The return value is a
+ type object and generally the same object as returned by ``object.__class__``.
The :func:`isinstance` built-in function is recommended for testing the type
of an object, because it takes subclasses into account.
- With three arguments, :func:`type` functions as a constructor as detailed
- below.
-
-
-.. function:: type(name, bases, dict)
- :noindex:
- Return a new type object. This is essentially a dynamic form of the
- :keyword:`class` statement. The *name* string is the class name and becomes the
- :attr:`__name__` attribute; the *bases* tuple itemizes the base classes and
- becomes the :attr:`__bases__` attribute; and the *dict* dictionary is the
- namespace containing definitions for class body and becomes the :attr:`__dict__`
- attribute. For example, the following two statements create identical
- :class:`type` objects:
+ With three arguments, return a new type object. This is essentially a
+ dynamic form of the :keyword:`class` statement. The *name* string is the
+ class name and becomes the :attr:`__name__` attribute; the *bases* tuple
+ itemizes the base classes and becomes the :attr:`__bases__` attribute;
+ and the *dict* dictionary is the namespace containing definitions for class
+ body and becomes the :attr:`__dict__` attribute. For example, the
+ following two statements create identical :class:`type` objects:
>>> class X:
... a = 1