Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Gary Herron Newsgroups: comp.lang.python Subject: Re: def __init__(self): Date: Tue, 26 Apr 2016 00:06:09 -0700 Lines: 30 Message-ID: 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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 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