Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107643

Re: def __init__(self):

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Gary Herron <gherron@digipen.edu>
Newsgroups comp.lang.python
Subject Re: def __init__(self):
Date Tue, 26 Apr 2016 00:06:09 -0700
Lines 30
Message-ID <mailman.99.1461654374.32212.python-list@python.org> (permalink)
References <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de YIdCZ+QwEm+9A5VEAxMiCAl3XyKF6QXnlqYqHtodsfEA==
Return-Path <gherron@digipen.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.114
X-Spam-Level *
X-Spam-Evidence '*H*': 0.78; '*S*': 0.00; 'constructor': 0.07; '__init__': 0.09; 'def': 0.13; 'suggest': 0.15; 'declaration': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'sense:': 0.16; 'subject:def': 0.16; 'tool.': 0.16; 'wrote:': 0.16; 'all,': 0.20; 'advance.': 0.23; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'class.': 0.30; "i'd": 0.31; 'skip:_ 10': 0.32; 'instances': 0.33; 'list': 0.34; 'but': 0.36; 'needed': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'thanks': 0.37; 'things': 0.38; 'skip:o 20': 0.38; 'why': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'high': 0.60; 'your': 0.60; 'valuable': 0.61; 'dr.': 0.69; 'received:204': 0.75; 'institute': 0.77; '(425)': 0.84; '895-4418': 0.84; 'digipen': 0.84; 'herron': 0.84; 'learn.': 0.84; 'subject:self': 0.84
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
In-Reply-To <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com>
X-Content-Filtered-By Mailman/MimeDel 2.1.22
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <571F1361.3010402@digipen.edu>
X-Mailman-Original-References <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com>
Xref csiph.com comp.lang.python:107643

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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