Bugs item #1649100, was opened at 2007-01-31 19:36 Message generated for change (Comment added) made by lastmohican You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1649100&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Parser/Compiler Group: Python 2.4 Status: Closed Resolution: Invalid Priority: 5 Private: No Submitted By: Sascha Peilicke (lastmohican) Assigned to: Nobody/Anonymous (nobody) Summary: Arithmetics behaving strange and magic underscore Initial Comment: Hello, i just found some strange things going around, could you please tell me if this is desired: >>> 3 + 4 7 >>> 3 +- 4 -1 >>> 3 +-+ 4 -1 >>> 3 +-+- 4 7 >>> 3 +-+-+ 4 7 >>> 3 +-+-+- 4 -1 >>> 3 +-+-+-+ 4 -1 >>> 3 +-+-+-+- 4 7 This was found in Python 2.4.4c1. And also another one: >>> _ Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name '_' is not defined >>> 3 == 3 True >>> _ True >>> 3 3 >>> _ 3 So what the hell is '_' something very strange indeed. ---------------------------------------------------------------------- >Comment By: Sascha Peilicke (lastmohican) Date: 2007-01-31 23:07 Message: Logged In: YES user_id=1465593 Originator: YES Ok, claryfies something, but i don't think, that this should be valid syntax. Maybe it is not a real bug, but definitly a gotcha. ---------------------------------------------------------------------- Comment By: Georg Brandl (gbrandl) Date: 2007-01-31 21:22 Message: Logged In: YES user_id=849994 Originator: NO In your first example, all + and - except the first + are seen as unary operators and modify the 4. In your second example: "_" is a convenience variable in the interactive interpreter and always bound to the latest expression result. At startup, there is no such result. ---------------------------------------------------------------------- Comment By: Sascha Peilicke (lastmohican) Date: 2007-01-31 19:39 Message: Logged In: YES user_id=1465593 Originator: YES I also found these working on the following: Python 2.5 (r25:51908, Oct 6 2006, 15:22:41) [GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu4)] on linux2 Seems to be a common 'problem' ? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1649100&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com