Overloadable Assignment PEP

Anders J. Munch andersjm at dancontrol.dk
Thu Apr 3 12:09:34 CEST 2003

"Drew Moore" <drew at astro.pas.rochester.edu> wrote:
> Howdy! 
> I submitted a pre-PEP on overloadable assignment. 
> The idea is:
> In situations where the assignment token "=" appears, and an augmented
> assignment symbol (such as +=, -=, *=, etc..) would also be
> syntactically correct, the assigned-to object would be checked for an
> __assign__(self, other) method. 

You terminology is off.  There is no such thing as an "assigned-to"
object in Python.  Assignments change bindings, not objects.

Take a step back and tell us what problem you are trying to solve.
Whatever it is, I'm sure we can think of a better solution than having
assignment depend on whatever object, if any, happened to be
previously bound to the same name.

python-is-not-c++-ly y'rs, Anders

More information about the Python-list mailing list