Confused about class behavior

Erik Max Francis max at alcyone.com
Sat Sep 16 14:53:16 EDT 2000


Brett Lempereur wrote:

> class C:
>     def __init__():
>         color = "green"
> 
> You wouldn't have the problem of the global colour changes.  I think

That would make color local to C.__init__, and would have no outside
effect on C or its instances.

> Oh yeah, anybody know how to implement class inheritance in Python?

    class Derived(Base):
        ...

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ The believer is happy; the doubter is wise.
\__/ (an Hungarian proverb)
    The laws list / http://www.alcyone.com/max/physics/laws/
 Laws, rules, principles, effects, paradoxes, etc. in physics.



More information about the Python-list mailing list