Terry Reedy wrote: > "Neal Becker" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> class X (object): >> pass >> >> X() += 2 >> >>> SyntaxError: can't assign to function call >> >> Suppose I actually had defined __iadd__ for class X. Python says this >> syntax is invalid. I wish is wasn't. > > If you translate to x() = x() +2, with x called just once, it does not make > sense. You can bind to names and slots in compound objects, but not to > objects.
This is similar to x = ([1], 2) x[0] += [2] which doesn't currently work either, though it could. Georg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com