"Greg Ewing" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| 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



_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to