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


Groups > comp.lang.python > #107650

Re: def __init__(self):

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: def __init__(self):
Date Tue, 26 Apr 2016 09:49:22 -0400
Lines 11
Message-ID <mailman.105.1461678569.32212.python-list@python.org> (permalink)
References <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> <85eg9sn7qo.fsf@benfinney.id.au> <1461678562.2463908.590020129.6D85452C@webmail.messagingengine.com>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de n4+Duo+t60VydWRuBE6k1wJUKm6BWe8HKR8Pfsa08iTg==
Return-Path <random832@fastmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'constructor': 0.07; 'instance.': 0.09; 'received:internal': 0.09; 'python': 0.10; '__new__': 0.16; 'initializes': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'subject:def': 0.16; 'wrote:': 0.16; 'saying': 0.22; 'header:In- Reply-To:1': 0.24; "can't": 0.32; 'class': 0.33; 'languages': 0.34; 'tue,': 0.34; '(and': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'method': 0.37; 'received:66': 0.38; 'does': 0.39; 'to:addr:python.org': 0.40; 'header:Message-Id:1': 0.61; 'skip:\xe2 10': 0.70; '26,': 0.72; '8bit%:43': 0.72; '8bit%:46': 0.76; 'construct': 0.84; 'subject:self': 0.84
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=/R26RoA5JqhhVgr5TI7TmKolkeI=; b=qnXX5J bzxw/emUl+7HQPjD7+86jqVCuHTjxnurVe15etk0hu7bT6I50REGOhGCvkl+JGku igVM27N5fxf3VTAnwupsDJ3Rw7gEd45hZuc6midb3D7bckJ7zYEk91+48yO9Cgl6 zbolmTBbz2+KN4UKo+M46xfuZRbkPdtNi96AE=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=/R26RoA5JqhhVgr 5TI7TmKolkeI=; b=psTOCRTMXDB+/VKKOeGRf2nG+rm0XsPHsY8u9OlrlwXPa0d /D0W0DuWi0L4P3+A0ty8LoOPC69+h3p+Hn6+rkAOjnDDa70CXYEKBGodnV9jADh6 CBc+lCqC62x8SEtdtSaye4c31ZYayB8nE+xWDOsTcMGI0ypgn0q8kXugAupw=
X-Sasl-Enc nLOymy10+y7CYH5JnYH6dsUlaHW88FnBHZozBa5fsc6f 1461678562
X-Mailer MessagingEngine.com Webmail Interface - ajax-b462e126
In-Reply-To <85eg9sn7qo.fsf@benfinney.id.au>
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 <1461678562.2463908.590020129.6D85452C@webmail.messagingengine.com>
X-Mailman-Original-References <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> <85eg9sn7qo.fsf@benfinney.id.au>
Xref csiph.com comp.lang.python:107650

Show key headers only | View raw


On Tue, Apr 26, 2016, at 03:34, Ben Finney wrote:
> 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 __new__ method is the *allocator*. "constructor" is used in many
languages to name a method that initializes an object once it already
"exists". Saying you can't call it that in Python is needlessly
confusing.

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