Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: def __init__(self): Date: Tue, 26 Apr 2016 17:34:39 +1000 Lines: 19 Message-ID: References: <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> <85eg9sn7qo.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de CPHwHQy2zM0bntAqiG9FfggPKzq/+s29DF/7RbEeih/A== Cancel-Lock: sha1:G40LikjY1XVgLTlUW+LUgri2Ne8= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'constructor': 0.07; '__init__': 0.09; 'instance.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'none).': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subject:def': 0.16; 'looked': 0.16; 'requests': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'wright': 0.29; 'class.': 0.30; 'class': 0.33; 'instances': 0.33; 'instance': 0.35; 'but': 0.36; 'needed': 0.36; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'received:org': 0.37; 'itself': 0.38; 'sure': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'christmas': 0.66; 'today.': 0.67; 'skip:\xe2 10': 0.70; '8bit%:43': 0.72; '8bit%:46': 0.76; '_o__)': 0.84; 'construct': 0.84; 'herron': 0.84; 'received:125': 0.84; 'subject:self': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) 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: <85eg9sn7qo.fsf@benfinney.id.au> X-Mailman-Original-References: <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> Xref: csiph.com comp.lang.python:107644 Gary Herron writes: > 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. That's needlessly confusing: ‘__init__’ is not a constructor because it does not construct the instance. The ‘__new__’ method is the constructor for a class (and returns the new instance). The ‘__init__’ method requests the already-constructed instance to initialise itself (and returns None). -- \ “I still have my Christmas Tree. I looked at it today. Sure | `\ enough, I couldn't see any forests.” —Steven Wright | _o__) | Ben Finney