From: Ezio Melotti Date: Wed, 24 Oct 2012 20:06:25 +0000 (+0300) Subject: #16210: combine the two type() docs. Patch by Pete Sevander. X-Git-Tag: v3.3.1rc1~750^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=837cd06d36f7e69fc51e5bce7631041161f9b864;p=python #16210: combine the two type() docs. Patch by Pete Sevander. --- diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index b7d7e087c4..31d8cf184c 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1353,29 +1353,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 diff --git a/Misc/ACKS b/Misc/ACKS index 8bdbe8f3c2..182c6a6d67 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -959,6 +959,7 @@ Jiwon Seo Joakim Sernbrant Roger Serwy Jerry Seutter +Pete Sevander Denis Severson Ian Seyer Ha Shao