Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'parameters': 0.04; 'argument': 0.05; 'impacts': 0.07; '*args,': 0.09; '__init__': 0.09; 'lawrence': 0.09; 'pointless': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'language.': 0.14; '__new__': 0.16; 'args,': 0.16; 'expecting': 0.16; 'object()': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'simplest': 0.16; 'subject:object': 0.16; 'subject:skip:m 10': 0.16; 'typeerror:': 0.16; 'language': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'example': 0.22; 'header:User-Agent:1': 0.23; 'passes': 0.24; 'sorry,': 0.24; "i've": 0.25; 'tracker': 0.26; 'least': 0.26; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'appreciated.': 0.29; 'andrew': 0.30; 'change,': 0.30; "i'm": 0.30; 'code': 0.31; '"",': 0.31; '>>>>': 0.31; 'file': 0.32; 'class': 0.32; 'worked': 0.33; '(most': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'doing': 0.36; 'method': 0.36; 'hi,': 0.36; 'searching': 0.37; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'ago.': 0.61; 'new': 0.61; 'happen': 0.63; 'our': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'convinced': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Basic misunderstanding on object creation Date: Wed, 13 May 2015 17:38:27 +0100 References: <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-179-197.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431535117 news.xs4all.nl 2884 [2001:888:2000:d::a6]:37036 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90568 On 13/05/2015 14:25, andrew cooke wrote: > > Hi, > > The following code worked on Python 3.2, but no longer works in 3.4. Did something change, or have I always been doing something dumb? > > (I realise the code is pointless as is - it's the simplest example I can give of a problem I am seeing with more complex code). > >>>> class Foo: > ... def __new__(cls, *args, **kargs): > ... print('new', args, kargs) > ... super().__new__(cls, *args, **kargs) > ... >>>> class Bar(Foo): > ... def __init__(self, a): > ... print('init', a) > ... >>>> Bar(1) > new (1,) {} > Traceback (most recent call last): > File "", line 1, in > File "", line 4, in __new__ > TypeError: object() takes no parameters > > What I was expecting to happen (and what happens in 3.2) is that the object.__new__ method passes the argument to the __init__ of the subclass. > > Any help appreciated. > > Thanks, > Andrew > I'm completely convinced that I've seen a change go through on the bug tracker that impacts on this area, but many months if not years ago. Unfortunately searching the bug tracker for super, __new__, __init__ and so on gets a lot of hits, leaving my Mk1 eyeballs overworked. At least I've tried but sorry, had to give up :( -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence