Confused about class behavior
Brett Lempereur
a.lempereur
Sat Sep 16 13:46:40 EDT 2000
More information about the Python-list mailing list
Sat Sep 16 13:46:40 EDT 2000
- Previous message (by thread): Compiling extension for 2.0b1
- Next message (by thread): Confused about class behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I think this is right, here's a little example i hope is correct
If you have created two instances of one class, if you change the master
without asigning something to the child, the child will always refer to the
master
So if you haven't actually set the color in class A or B it will always
refer to its parent class before it does anything. If however you were to
do this in the class
class C:
def __init__():
color = "green"
You wouldn't have the problem of the global colour changes. I think
Oh yeah, anybody know how to implement class inheritance in Python?
- Previous message (by thread): Compiling extension for 2.0b1
- Next message (by thread): Confused about class behavior
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list