Suggestion for "syntax error": ++i, --i

Mel Wilson mwilson at the-wire.com
Mon Dec 13 20:16:12 EST 2004


In article <cpkgda$pt3$04$1 at news.t-online.com>,
Christian Ergh <christian.ergh at gmail.com> wrote:
>Ah, ok, i misunderstood you. Well, to mark it as a syntax error sounds
>good, and at the Moment I would not know a case where this conflicts
>with a implementation.

   Well, you can overload prefix `+` and `-` operators on an
object by defining __pos__ and __neg__ methods, so --a, ++a,
+-a, -+a, +-+a and other similar combinations are actually
good syntax, and as useful as you want them to be.

        Regards.        Mel.



More information about the Python-list mailing list