[ python-Bugs-853556 ] ++variable does not raise an error

SourceForge.net noreply at sourceforge.net
Thu Dec 4 06:14:49 EST 2003


Bugs item #853556, was opened at 2003-12-03 20:21
Message generated for change (Comment added) made by mwh
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853556&group_id=5470

Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Eric Meyer (meyeet)
>Assigned to: Michael Hudson (mwh)
Summary: ++variable does not raise an error

Initial Comment:
While converting a large amount of C++ source over to 
python we were caught by surprise that leaving in a 
illegal command of '++variable' did not raise an error 
while 'variable++' did.  Luckly we caught this early in 
degugging our problem.

We're running python 2.3.1 on windows 2000.

Python 2.3.1 (#47, Sep 23 2003, 23:47:32) [MSC 
v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more 
information.
>>> test = 0
>>> test
0
>>> ++test
0
>>> test++
  File "<stdin>", line 1
    test++
         ^
SyntaxError: invalid syntax


----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2003-12-04 11:14

Message:
Logged In: YES 
user_id=6656

++var is actually meaningful (if usually pointless), so it
would be bad form (IMHO) to ban it.

I think pychecker checks for this and in any case that's the
place for things like this.

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2003-12-03 20:30

Message:
Logged In: YES 
user_id=89016

++test is the same as +(+test). + is used as an unary
operator (in symmetry with unary -) and does nothing.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=853556&group_id=5470



More information about the Python-bugs-list mailing list