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


Groups > comp.lang.python > #90561

Re: Basic misunderstanding on object creation

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.038
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; '*args,': 0.09; 'constructor': 0.09; 'def': 0.12; 'args,': 0.16; 'none.': 0.16; 'subject:object': 0.16; 'subject:skip:m 10': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'andrew': 0.30; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; '>>>>': 0.31; 'class': 0.32; 'skip:_ 10': 0.34; 'received:google.com': 0.35; 'returning': 0.36; 'to:addr:python-list': 0.38; 'anything': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'new': 0.61; "you're": 0.61; 'skip:n 10': 0.64; '2015': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=C31SrXRMJnBTZpF9FdanLBuzk6p8bsR/S3/YHUJ8p+U=; b=G8Tp/I/5zvllzZKkaqg4TSdLFLbQL5txEXM/Jqjp3muCOMdHy5BOTujeEdhWv5pIyR +rRK+yTnL49q+ZcQQgXked/ZmGxiPvfczK1r6PzMjx4dIdWdipm24zX9CdsJW2iTSxaZ SfvuUDgy2I57+JaItDPuR1pzNMxbLn0bcJlBFt0YY9ZyGjaZgODagaiXyZsDnKrRV7pq ZuwKthIOySRHktM8G5DV3rTk4yC7TLYru2ovQJ+mC3mKgYsPbLyfUXKx3yeMqDNZK/v5 V7BjnUNwyQIEjYDYxcj493UKnwA5F5Czuacv4aNUIiBFYUdySGOSG6XAJ7tYarQdu33c De8g==
X-Received by 10.50.30.69 with SMTP id q5mr105099igh.11.1431528959971; Wed, 13 May 2015 07:55:59 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <e09c84fe-609c-4794-a117-fc72c8ccf3ad@googlegroups.com>
References <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> <mivmr0$1mb$1@r01.glglgl.de> <06301cb8-39a6-410b-9fad-afe6bd4d3217@googlegroups.com> <e09c84fe-609c-4794-a117-fc72c8ccf3ad@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 13 May 2015 08:55:19 -0600
Subject Re: Basic misunderstanding on object creation
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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>
Newsgroups comp.lang.python
Message-ID <mailman.448.1431528969.12865.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431528969 news.xs4all.nl 2894 [2001:888:2000:d::a6]:58205
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90561

Show key headers only | View raw


On Wed, May 13, 2015 at 8:45 AM, andrew cooke <andrew@acooke.org> wrote:
>>>> class Foo:
> ...     def __new__(cls, *args, **kargs):
> ...         print('new', args, kargs)
> ...         super().__new__(cls)
> ...
>>>> class Bar(Foo):
> ...     def __init__(self, a):
> ...         print('init', a)
> ...
>>>> Bar(1)
> new (1,) {}
>
> no "init" is printed.

You're not returning anything from Foo.__new__, so the result of the
constructor is None.  None.__init__ does nothing.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Basic misunderstanding on object creation andrew cooke <andrew@acooke.org> - 2015-05-13 06:25 -0700
  Re: Basic misunderstanding on object creation Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2015-05-13 16:24 +0200
    Re: Basic misunderstanding on object creation andrew cooke <andrew@acooke.org> - 2015-05-13 07:42 -0700
      Re: Basic misunderstanding on object creation andrew cooke <andrew@acooke.org> - 2015-05-13 07:45 -0700
        Re: Basic misunderstanding on object creation Peter Otten <__peter__@web.de> - 2015-05-13 16:55 +0200
        Re: Basic misunderstanding on object creation Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-13 08:55 -0600
          Re: Basic misunderstanding on object creation andrew cooke <andrew@acooke.org> - 2015-05-13 08:52 -0700
      Re: Basic misunderstanding on object creation Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-13 08:54 -0600
  Re: Basic misunderstanding on object creation Terry Reedy <tjreedy@udel.edu> - 2015-05-13 12:36 -0400
    Re: Basic misunderstanding on object creation andrew cooke <andrew@acooke.org> - 2015-05-13 11:42 -0700
      Re: Basic misunderstanding on object creation Terry Reedy <tjreedy@udel.edu> - 2015-05-13 15:17 -0400
      Re: Basic misunderstanding on object creation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-13 20:45 +0100
        Re: Basic misunderstanding on object creation Ned Batchelder <ned@nedbatchelder.com> - 2015-05-13 13:33 -0700
          Re: Basic misunderstanding on object creation Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-14 11:07 +1000
  Re: Basic misunderstanding on object creation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-13 17:38 +0100
  Re: Basic misunderstanding on object creation Terry Reedy <tjreedy@udel.edu> - 2015-05-13 13:05 -0400
  Re: Basic misunderstanding on object creation Terry Reedy <tjreedy@udel.edu> - 2015-05-13 13:13 -0400
  Re: Basic misunderstanding on object creation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-13 18:43 +0100

csiph-web