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


Groups > comp.lang.python > #35844 > unrolled thread

Re: father class name

Started byBen Finney <ben+python@benfinney.id.au>
First post2012-12-31 20:23 +1100
Last post2013-01-01 03:24 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: father class name Ben Finney <ben+python@benfinney.id.au> - 2012-12-31 20:23 +1100
    Re: father class name Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-01 03:24 +0000

#35844 — Re: father class name

FromBen Finney <ben+python@benfinney.id.au>
Date2012-12-31 20:23 +1100
SubjectRe: father class name
Message-ID<mailman.1494.1356945835.29569.python-list@python.org>
Chris Rebert <clp2@rebertia.com> writes:

> By contrast, in the first part of the *expression*
> `haha(object).theprint()`, you passed an argument (namely, `object`).
> Since __init__() wasn't expecting any arguments whatsoever, you
> therefore got an error.

Why is everyone talking about the initialiser, ‘__init__’?

When:

> >>>> haha(object).theprint()
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> > TypeError: object.__new__() takes no parameters

The error is talking about the constructor, ‘__new__’.

-- 
 \          “It's dangerous to be right when the government is wrong.” |
  `\                                   —Francois Marie Arouet Voltaire |
_o__)                                                                  |
Ben Finney

[toc] | [next] | [standalone]


#35872

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-01-01 03:24 +0000
Message-ID<50e256ee$0$30003$c3e8da3$5496439d@news.astraweb.com>
In reply to#35844
On Mon, 31 Dec 2012 20:23:44 +1100, Ben Finney wrote:

> Chris Rebert <clp2@rebertia.com> writes:
> 
>> By contrast, in the first part of the *expression*
>> `haha(object).theprint()`, you passed an argument (namely, `object`).
>> Since __init__() wasn't expecting any arguments whatsoever, you
>> therefore got an error.
> 
> Why is everyone talking about the initialiser, ‘__init__’?
> 
> When:
> 
>> >>>> haha(object).theprint()
>> > Traceback (most recent call last):
>> >   File "<stdin>", line 1, in <module>
>> > TypeError: object.__new__() takes no parameters
> 
> The error is talking about the constructor, ‘__new__’.


Good point.

I think we do a disservice to newbies when we (inadvertently) discourage 
them from reading the tracebacks generated by an error. The traceback 
clearly talks about a __new__ method.

I don't believe that talking about the constructor __new__ is so 
complicated that we should ignore the actual error and go of on a wild-
goose chase about the initialiser __init__, especially since adding an 
__init__ method to the class *won't solve the problem*.

Sorry Chris, I think you dropped the ball on this one and gave an overtly 
misleading answer :-(



-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web