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


Groups > comp.lang.python > #90575

Re: Basic misunderstanding on object creation

X-Received by 10.182.28.99 with SMTP id a3mr464256obh.18.1431542565635; Wed, 13 May 2015 11:42:45 -0700 (PDT)
X-Received by 10.140.33.100 with SMTP id i91mr7093qgi.41.1431542565572; Wed, 13 May 2015 11:42:45 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!m20no4485806iga.0!news-out.google.com!k20ni2301qgd.0!nntp.google.com!j5no8309236qga.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Wed, 13 May 2015 11:42:45 -0700 (PDT)
In-Reply-To <mailman.451.1431534990.12865.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=190.21.113.94; posting-account=_quEtAoAAADNO7l2OQPj0XsLlkl0eAhA
NNTP-Posting-Host 190.21.113.94
References <25ba3a96-21ee-4a83-b7c1-8ac60508d30c@googlegroups.com> <mailman.451.1431534990.12865.python-list@python.org>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <624b0ba1-3d8a-44fe-a774-69d2d87e2cd0@googlegroups.com> (permalink)
Subject Re: Basic misunderstanding on object creation
From andrew cooke <andrew@acooke.org>
Injection-Date Wed, 13 May 2015 18:42:45 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:90575

Show key headers only | View raw


On Wednesday, 13 May 2015 13:37:23 UTC-3, Terry Reedy  wrote:
> On 5/13/2015 9:25 AM, andrew cooke wrote:
> 
> > The following code worked on Python 3.2, but no longer works in 3.4.
> 
> Bugfixes break code that depends on buggy behavior. See
> https://bugs.python.org/issue1683368
> Your code also fails in 2.7.9 if you inherit Foo from object.
> The exact error messages changed for 3.4 in
> https://bugs.python.org/issue7963
> 
>  > Did something change,
> 
> Obviously yes.

thanks, but why does someone on this group always have to be a dick and make some smart-assed comment like this?

>  > or have I always been doing something dumb?
> 
> You were depending on behavior of object that Guido decided was buggy.
> 
> I found the tracker issue by looking for 'object' in the Core and 
> Builtins sections of the changelog one can access from What's New, first 
> paragraph (using Highlight All in Firefox).
> 
> >>>> 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 "<stdin>", line 1, in <module>
> >    File "<stdin>", 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.
> 
> -- 
> Terry Jan Reedy

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