[Tutor] Class definition confusion
Mark Lawrence
breamoreboy at yahoo.co.uk
Wed Feb 15 20:01:04 CET 2012
On 15/02/2012 18:35, Hugo Arts wrote:
[snip]
> An __init__ might seem like it's special in some way, declaring
> attributes. But it's not, really, it's just another method that gets
> passed the object it is called on (that would be "self"). It's only
> special because it gets called when an object is created, so generally
> an object is initialized there and attributes are assigned (hence the
> name "init").'
>
> HTH,
> Hugo
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
To the OP.
Note that __init__ is an initialiser and not a constructor which is
__new__, see e.g.
http://mail.python.org/pipermail/tutor/2008-April/061426.html
--
Cheers.
Mark Lawrence.
More information about the Tutor
mailing list