On Thu, Feb 23, 2017 at 09:40:14PM +1100, Steven D'Aprano wrote:

> How do instance attributes normally get set? In the __init__ method:
> 
> class MyClass:
>     def __init__(self):
>         self.attribute = None
> 
> 
> If the __init__ method does get run, it doesn't get the chance to create 
> the instance attributes. So if you have a subclass that defines 
> __init__, you need to allow the superclass' __init__ to run too.

/me slaps forehead

Of course I meant to write:

If the __init__ method does NOT get run, it doesn't get the chance to 
create the instance attributes.


Sorry for any confusion.


-- 
Steve
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to