Alexandre Fayolle wrote: > On Monday 23 November 2009 10:49:38 Emile Anclin wrote: >> Hello, >> >> On Wednesday 18 November 2009 22:19:26 James Lingard wrote: >>> x = y = 0 >>> print ++x >>> >>> ************* Module pylint-misc >>> E9800: 2: Use of the non-existent ++ operator >> I have a little doubt about this message. I would not say, there is a use >> of an "non-existent operator". >> >> It isn't an error, simply it will be considered as "(+(+a))" : > > I fail to see a single case where it makes sense to write ++x in Python. Sure > it is syntactically correct but: > > * in the best case it's a typo (the author wanted to write +x and typed + > twice) > * in the worst case, the author is a C programmer and meant something else > * it is anyway visually confusing and disgraceful. > > Therefore, imo it deserves an Error.
But it is no error. It is perfectly legal to implement `__pos__()` in a
way that makes sense to call it repeatedly. Even to implement that two
successive calls increment something to mimic some C++ behaviour. Butt
ugly, but legal.
Ciao,
Marc 'BlackJack' Rintsch
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
