[Python-3000] PEP3099 += 'Assignment will not become anoperation' (original) (raw)
Terry Reedy tjreedy at udel.edu
Thu May 3 10:17:15 CEST 2007
- Previous message: [Python-3000] PEP3099 += 'Assignment will not become an operation'
- Next message: [Python-3000] [Python-Dev] PEP 30XZ: Simplified Parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote in message news:463981B2.6090704 at canterbury.ac.nz... | Terry Reedy wrote: | > and hence '=' will not become an operator and hence '=' will not become | > overloadable. || Actually, '=' is overloadable in most cases,
It is not overloadable in the sense I meant, and in the sense people occasionally request, which is to have '=' be an operation that invokes a special method such as assign, just as the '+' operation invokes 'add'.
| you can arrange for a suitably customised object | to be used as the namespace being assigned into. | About the only case you can't hook is assignment | to a local name in a function.
I mentioned purse classes in the appropriate place -- c.l.p. I cannot think of any way to make plain assignment statements ('a = object') at module scope do anything other than bind an object to a name in the global namespace.
Back to my original point: people occasionally ask that assignment statements become assignment expressions, as in C, by making '=' an operation with an overloadable special method. Guido has consistently said no. This came up again today. Since this is a much more frequent request than some of the items already in 3099, I think it should be added their.
Terry Jan Reedy
- Previous message: [Python-3000] PEP3099 += 'Assignment will not become an operation'
- Next message: [Python-3000] [Python-Dev] PEP 30XZ: Simplified Parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]