[Python-bugs-list] [ python-Bugs-595791 ] IDLE/Command Line Output Differ
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 18 Aug 2002 12:42:23 -0700
Bugs item #595791, was opened at 2002-08-15 19:01
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=595791&group_id=5470
Category: IDLE
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: James Pomeroy (moody834)
Assigned to: Raymond Hettinger (rhettinger)
Summary: IDLE/Command Line Output Differ
Initial Comment:
Platform: OS X 10.1.5
XDarwin: 1.1 (XFree86 4.2)
IDLE: 0.8
Python: 2.2.1
Code (from Python Tutorial sec. 4.4) [I don't know if my
indentation will be preserved here, but the code was indented per
Python convention]:
>>> for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print n, 'equals', x, '*', n/x
... break
... else:
... # loop fell through without finding a factor
... print n, 'is a prime number'
Result in IDLE:
3 is a prime number
4 equals 2 * 2
5 is a prime number
5 is a prime number
5 is a prime number
6 equals 2 * 3
7 is a prime number
7 is a prime number
7 is a prime number
7 is a prime number
7 is a prime number
8 equals 2 * 4
9 is a prime number
9 equals 3 * 3
Result using (xterm) command line matched example given in
Python Tutorial:
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
----------------------------------------------------------------------
>Comment By: Raymond Hettinger (rhettinger)
Date: 2002-08-18 14:42
Message:
Logged In: YES
user_id=80475
Hello James,
It looks like your bug report has an error in that it is
not "indented per Python convention". When it was hand
typed into IDLE, the 'else' clause needed to be aligned with
the outermost 'for' rather than the 'if' block. That is an
easy typo to make since IDLE automatically indents to
most recent block and you have to hit backspace to move
out a level.
Thank you for submitting the bug report. If you find
something else, please let us know. In the meantime, I'll
mark this one as invalid and close the report.
Raymond Hettinger
----------------------------------------------------------------------
Comment By: James Pomeroy (moody834)
Date: 2002-08-16 10:22
Message:
Logged In: YES
user_id=448016
UPDATE:
This issue all appears if I use OS X's default terminal. Same output as
with IDLE. So, only xterm produces the result expected.
----------------------------------------------------------------------
Comment By: Gregor Lingl (glingl)
Date: 2002-08-16 07:00
Message:
Logged In: YES
user_id=505031
Apparently this is a bug in the INPUT to IDLE,
as the incorrect output is produced, if the else-part in
the statement is incorrectly idented as part of the if-statement
instead as a part of the for-statement
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=595791&group_id=5470