On Tue, 17 Jan 2006 16:47:15 -0800, James Stroud <[EMAIL PROTECTED]> wrote: >braver wrote: >> Well, I know some python, but since there are powerful and magical >> features in it, I just wonder whether there're some which address this >> issue better than others. >> > >In python, += is short, of course, for > >a = a + 1 >
No it's not. It's short for if isinstance(a, object): if hasattr(a.__class__, '__iadd__'): _x = a.__class__.__iadd__(a, b) if _x is NotImplemented: a = b + a else: a = _x else: a = b + a else: if hasattr(a, '__iadd__'): _x = a.__iadd__(b) if _x is NotImplemented: a = b + a else: a = _x else: a = b + a Roughly speaking, anyway. Not that this is relevant to your point. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list