[Python-bugs-list] [ python-Bugs-595791 ] IDLE/Command Line Output Differ
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 16 Aug 2002 08:22:08 -0700
Bugs item #595791, was opened at 2002-08-15 17:01
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=595791&group_id=5470
Category: IDLE
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: James Pomeroy (moody834)
Assigned to: Nobody/Anonymous (nobody)
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: James Pomeroy (moody834)
Date: 2002-08-16 08: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 05: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