def __init__(self):
Gary Herron
gherron at digipen.edu
Tue Apr 26 03:06:09 EDT 2016
On 04/25/2016 11:21 PM, San wrote:
> Hi All,
>
> Pls let me why
> "
> def __init__(self):
>
> "
> declaration required, what's the use of this one.Pls explain me in details.
>
> Thanks in advance.
If you understand object-oriented-programming, then this will make sense:
The __init__ method is the constructor for instances of a class. It
is not required, but the situations in which a constructor is not
needed are few and unusual.
If you don't know object-oriented-programming, then I'd suggest you put
that high on your list of things to learn. It's a valuable tool.
Gary Herron
--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418
More information about the Python-list
mailing list