[Python-Dev] ++x oddnes
Thomas Wouters
thomas@xs4all.net
Fri, 10 Aug 2001 17:54:14 +0200
On Fri, Aug 10, 2001 at 10:21:58AM -0500, Charles G Waldman wrote:
> ++x
> Interestingly, this runs, it just never terminates! Looks like
> somehow ++x is being parsed as "+0 + x".
Actually, it's being parsed as '+(+x)':
6 LOAD_FAST 0 (x)
9 UNARY_POSITIVE
10 UNARY_POSITIVE
The same goes for '--x'. If it were parsed as '+0 + x', 'x++' would also be
parsed as 'x + +0'.
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!