Overloading the = operator?

Justin Sheehy dworkin at ccs.neu.edu
Sat Apr 22 21:45:47 EDT 2000


Jerome Chan <eviltofu at rocketmail.com> writes:

> Is this possible?

> x = base([1,2])
> y = another([2,4,3])
> 
> z = other([])
> 
> z = x + y
> z.work()
> 
> where z now contains x.list + y.list???

Nope.  `=' rebinds the name on the left hand side, and never even
looks to see what that name was previously bound to.  

-Justin

 






More information about the Python-list mailing list