Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 044bb4d

Browse files
committed
Explain that __init__() methods do not get to return values.
1 parent 2b8d7bd commit 044bb4d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

Doc/ref/ref3.tex

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -892,14 +892,15 @@ \section{Special method names\label{specialnames}}
892892

893893
\subsection{Basic customization\label{customization}}
894894

895-
\begin{methoddesc}[object]{__init__}{self\optional{, args...}}
896-
Called when the instance is created. The arguments are those passed
897-
to the class constructor expression. If a base class has an
898-
\method{__init__()} method the derived class's \method{__init__()} method must
899-
explicitly call it to ensure proper initialization of the base class
900-
part of the instance, e.g., \samp{BaseClass.__init__(\var{self},
901-
[\var{args}...])}.
902-
\indexii{class}{constructor}
895+
\begin{methoddesc}[object]{__init__}{self\optional{, \moreargs}}
896+
Called\indexii{class}{constructor} when the instance is created. The
897+
arguments are those passed to the class constructor expression. If a
898+
base class has an \method{__init__()} method the derived class's
899+
\method{__init__()} method must explicitly call it to ensure proper
900+
initialization of the base class part of the instance; for example:
901+
\samp{BaseClass.__init__(\var{self}, [\var{args}...])}. As a special
902+
contraint on constructors, no value may be returned; doing so will
903+
cause a \exception{TypeError} to be raised at runtime.
903904
\end{methoddesc}
904905

905906

0 commit comments

Comments
 (0)