Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b8fbff88
Commit
b8fbff88
authored
Oct 24, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#16210: combine the two type() docs. Patch by Pete Sevander.
parent
9ad6a563
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
17 deletions
+13
-17
Doc/library/functions.rst
Doc/library/functions.rst
+12
-17
Misc/ACKS
Misc/ACKS
+1
-0
No files found.
Doc/library/functions.rst
View file @
b8fbff88
...
...
@@ -1426,26 +1426,21 @@ 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. The
:func:`isinstance` built-in function is recommended for testing the type of an
object.
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 one argument, return the type of an *object*. The return value is a
type object. The :func:`isinstance` built-in function is recommended for
testing the type of an object.
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(object):
... a = 1
...
...
Misc/ACKS
View file @
b8fbff88
...
...
@@ -884,6 +884,7 @@ Jiwon Seo
Joakim Sernbrant
Roger Serwy
Jerry Seutter
Pete Sevander
Denis Severson
Ian Seyer
Ha Shao
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment