X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 78.192.65.63 Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!news.muarf.org!news.roellig-ltd.de!open-news-network.org!news4.open-news-network.org!.POSTED!not-for-mail From: Thomas Rachel Newsgroups: comp.lang.python Subject: Re: Basic misunderstanding on object creation Date: Wed, 13 May 2015 16:24:27 +0200 Organization: A not so newly installed InterNetNews server Lines: 25 Message-ID: References: <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> NNTP-Posting-Host: r01.glglgl.de Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news4.open-news-network.org 1431528663 27147 37.59.37.191 (13 May 2015 14:51:03 GMT) X-Complaints-To: usenet@titan550.startdedicated.de NNTP-Posting-Date: Wed, 13 May 2015 14:51:03 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 Hamster/2.1.0.11 In-Reply-To: <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> Xref: csiph.com comp.lang.python:90554 Am 13.05.2015 um 15:25 schrieb andrew cooke: >>>> class Foo: > ... def __new__(cls, *args, **kargs): > ... print('new', args, kargs) > ... super().__new__(cls, *args, **kargs) > new (1,) {} > Traceback (most recent call last): > File "", line 1, in > File "", line 4, in __new__ > TypeError: object() takes no parameters object's __new__() dosn't take any parameters. So call it without arguments: class Foo: def __new__(cls, *args, **kargs): print('new', args, kargs) super().__new__(cls) (at least if we know that we inherit from object. Might be that this one doesn't work very good with multiple inheritance...) Thomas