Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107643
| From | Gary Herron <gherron@digipen.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: def __init__(self): |
| Date | 2016-04-26 00:06 -0700 |
| Message-ID | <mailman.99.1461654374.32212.python-list@python.org> (permalink) |
| References | <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
def __init__(self): San <santanu01@gmail.com> - 2016-04-25 23:21 -0700
Re: def __init__(self): Ben Finney <ben+python@benfinney.id.au> - 2016-04-26 16:31 +1000
Re: def __init__(self): Gary Herron <gherron@digipen.edu> - 2016-04-26 00:06 -0700
Re: def __init__(self): Ben Finney <ben+python@benfinney.id.au> - 2016-04-26 17:34 +1000
Re: def __init__(self): Marko Rauhamaa <marko@pacujo.net> - 2016-04-26 11:25 +0300
Re: def __init__(self): Steven D'Aprano <steve@pearwood.info> - 2016-04-27 02:12 +1000
Re: def __init__(self): Random832 <random832@fastmail.com> - 2016-04-26 12:26 -0400
Re: def __init__(self): Steven D'Aprano <steve@pearwood.info> - 2016-04-27 02:32 +1000
Re: def __init__(self): Chris Kaynor <ckaynor@zindagigames.com> - 2016-04-26 09:59 -0700
Re: def __init__(self): Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-27 14:54 +1000
Re: def __init__(self): Chris Angelico <rosuav@gmail.com> - 2016-04-27 03:04 +1000
Re: def __init__(self): Chris Kaynor <ckaynor@zindagigames.com> - 2016-04-26 10:13 -0700
Re: def __init__(self): Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-26 11:26 -0600
Re: def __init__(self): Chris Angelico <rosuav@gmail.com> - 2016-04-27 03:30 +1000
Re: def __init__(self): Marko Rauhamaa <marko@pacujo.net> - 2016-04-26 19:38 +0300
Re: def __init__(self): Random832 <random832@fastmail.com> - 2016-04-26 09:49 -0400
Re: def __init__(self): Gary Herron <gherron@digipen.edu> - 2016-04-26 07:25 -0700
csiph-web