Its "under under", not "under under under" before and after init
--Michael
On 12/17/07, earlylight publishing <[EMAIL PROTECTED]> wrote:
> Okay I copied this code directly from a book (author Michael Dawson) and
> it's not working. I'm sure I've missed something obvious like the spacing
Your init method has 3 underscores each side, it should be 2.
(As all the magic methods in Python do)
The result is the init is not recognised as an initialiser and
the default object.new method is called. as the messaage
says it takes no parameters...
HTH,
Alan G.
"earlylight publishing" <[EMA
On Dec 17, 2007 12:16 PM, earlylight publishing <
[EMAIL PROTECTED]> wrote:
>
> class Critter(object):
> """A virtual pet"""
> def ___init___(self, name):
> print "A new critter has been born!"
>
>
You're using 3 underscores before and after 'init'. The constructor for
Python cla
I have no idea why I did that either. I know perfectly well it's supposed to
be 2 underscores! Thanks to everyone who spotted the problem.
"Michael H. Goldwasser" <[EMAIL PROTECTED]> wrote:
You've inadvertently used three underscores around __init__ rather
than two, and therefore you are no
You've inadvertently used three underscores around __init__ rather
than two, and therefore you are not really defining __init__ but
instead are relying upon the inherited one from object (which takes no
parameters).
With regard,
Michael
On Monday December 17, 2007, earlylight publishing wrote:
earlylight publishing wrote:
> class Critter(object):
> """A virtual pet"""
> def ___init___(self, name):
Too many underscores, just use two before and two behind, i.e. __init__
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.or
Okay I copied this code directly from a book (author Michael Dawson) and it's
not working. I'm sure I've missed something obvious like the spacing or
something but I've been staring at it for 10 minutes and I can't see it. I'll
put the code and error message below. Can someone else spot the p