C
C GIllespie
Dear all,
I'm new to both python and OOP, so could I ask a simple question.
I have class:
class species:
__init__(self,pop=0):
self.pop=pop
Now I want to do something like this:
X=species(pop=10)
Y=species(pop=X.pop)
OK, but now I want to update X.pop and have that mirrored in Y.pop, i.e. if
X.pop=5, Y.pop now equals 5.
What is the best/nicest/simplest way of doing this?
Many thanks
Colin
I'm new to both python and OOP, so could I ask a simple question.
I have class:
class species:
__init__(self,pop=0):
self.pop=pop
Now I want to do something like this:
X=species(pop=10)
Y=species(pop=X.pop)
OK, but now I want to update X.pop and have that mirrored in Y.pop, i.e. if
X.pop=5, Y.pop now equals 5.
What is the best/nicest/simplest way of doing this?
Many thanks
Colin