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
0c3936fd
Commit
0c3936fd
authored
Aug 02, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain that __init__() methods do not get to return values.
parent
b33973c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Doc/ref/ref3.tex
Doc/ref/ref3.tex
+9
-8
No files found.
Doc/ref/ref3.tex
View file @
0c3936fd
...
...
@@ -892,14 +892,15 @@ extracting a slice may not make sense. (One example of this is the
\subsection
{
Basic customization
\label
{
customization
}}
\begin{methoddesc}
[object]
{__
init
__}{
self
\optional
{
, args...
}}
Called when the instance is created. The arguments are those passed
to the class constructor expression. If a base class has an
\method
{__
init
__
()
}
method the derived class's
\method
{__
init
__
()
}
method must
explicitly call it to ensure proper initialization of the base class
part of the instance, e.g.,
\samp
{
BaseClass.
__
init
__
(
\var
{
self
}
,
[
\var
{
args
}
...])
}
.
\indexii
{
class
}{
constructor
}
\begin{methoddesc}
[object]
{__
init
__}{
self
\optional
{
,
\moreargs
}}
Called
\indexii
{
class
}{
constructor
}
when the instance is created. The
arguments are those passed to the class constructor expression. If a
base class has an
\method
{__
init
__
()
}
method the derived class's
\method
{__
init
__
()
}
method must explicitly call it to ensure proper
initialization of the base class part of the instance; for example:
\samp
{
BaseClass.
__
init
__
(
\var
{
self
}
, [
\var
{
args
}
...])
}
. As a special
contraint on constructors, no value may be returned; doing so will
cause a
\exception
{
TypeError
}
to be raised at runtime.
\end{methoddesc}
...
...
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