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
52e46bd2
Commit
52e46bd2
authored
Jan 14, 2015
by
Ethan Furman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue20467: clarify __init__'s role
parent
aecea3d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
Doc/reference/datamodel.rst
Doc/reference/datamodel.rst
+11
-7
No files found.
Doc/reference/datamodel.rst
View file @
52e46bd2
...
...
@@ -1081,13 +1081,17 @@ Basic customization
.. index:: pair: class; constructor
Called when the instance is created. The arguments are those passed to the
class constructor expression. If a base class has an :meth:`__init__` method,
the derived class's :meth:`__init__` method, if any, must explicitly call it to
ensure proper initialization of the base class part of the instance; for
example: ``BaseClass.__init__(self, [args...])``. As a special constraint on
constructors, no value may be returned; doing so will cause a :exc:`TypeError`
to be raised at runtime.
Called after the instance has been created (by :meth:`__new__`), but before
it is returned to the caller. The arguments are those passed to the
class constructor expression. If a base class has an :meth:`__init__`
method, the derived class's :meth:`__init__` method, if any, must explicitly
call it to ensure proper initialization of the base class part of the
instance; for example: ``BaseClass.__init__(self, [args...])``.
Because :meth:`__new__` and :meth:`__init__` work together in constructing
objects (:meth:`__new__` to create it, and :meth:`__init__` to customise it),
no non-``None`` value may be returned by :meth:`__init__`; doing so will
cause a :exc:`TypeError` to be raised at runtime.
.. method:: object.__del__(self)
...
...
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