Why not an __assign__ method?

Pete Shinners shredwheat at mediaone.net
Fri Mar 30 12:48:20 EST 2001


> The question is: Why not have a __assign__ method, that gets called on
> assignment? It should be called on the *right side* of the expression (at
> the left side it does not make sense - I leave the proof as an exercise for
> the reader <wink>). The return value would be then assigned to the left
> side of the expression. This is the default behavior:

i'm not quite sure how this would work. assigning variables
have nothing to do with the type a variable 'currently' refers to.

a = None
a = huge_array1 + huge_array2

the variable could point to anything before being assigned. the
assignment in no way effects what the variable originally refers
to, so it doesn't seem like whatever that was should get a say in
what happens to the "new owner"






More information about the Python-list mailing list