Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLE/Command Line Output Differ #37042

Closed
moody834 mannequin opened this issue Aug 16, 2002 · 5 comments
Closed

IDLE/Command Line Output Differ #37042

moody834 mannequin opened this issue Aug 16, 2002 · 5 comments
Assignees

Comments

@moody834
Copy link
Mannequin

moody834 mannequin commented Aug 16, 2002

BPO 595791
Nosy @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/rhettinger'
closed_at = <Date 2002-08-18.20:19:13.000>
created_at = <Date 2002-08-16.00:01:17.000>
labels = ['expert-IDLE', 'invalid']
title = 'IDLE/Command Line Output Differ'
updated_at = <Date 2002-08-18.20:19:13.000>
user = 'https://bugs.python.org/moody834'

bugs.python.org fields:

activity = <Date 2002-08-18.20:19:13.000>
actor = 'moody834'
assignee = 'rhettinger'
closed = True
closed_date = None
closer = None
components = ['IDLE']
creation = <Date 2002-08-16.00:01:17.000>
creator = 'moody834'
dependencies = []
files = []
hgrepos = []
issue_num = 595791
keywords = []
message_count = 5.0
messages = ['12009', '12010', '12011', '12012', '12013']
nosy_count = 3.0
nosy_names = ['rhettinger', 'glingl', 'moody834']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue595791'
versions = []

@moody834
Copy link
Mannequin Author

moody834 mannequin commented Aug 16, 2002

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

@moody834 moody834 mannequin closed this as completed Aug 16, 2002
@moody834 moody834 mannequin added the invalid label Aug 16, 2002
@moody834 moody834 mannequin assigned rhettinger Aug 16, 2002
@moody834 moody834 mannequin added the topic-IDLE label Aug 16, 2002
@moody834 moody834 mannequin closed this as completed Aug 16, 2002
@moody834 moody834 mannequin added the invalid label Aug 16, 2002
@moody834 moody834 mannequin assigned rhettinger Aug 16, 2002
@moody834 moody834 mannequin added the topic-IDLE label Aug 16, 2002
@glingl
Copy link
Mannequin

glingl mannequin commented Aug 16, 2002

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

@moody834
Copy link
Mannequin Author

moody834 mannequin commented Aug 16, 2002

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.

@rhettinger
Copy link
Contributor

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

@moody834
Copy link
Mannequin Author

moody834 mannequin commented Aug 18, 2002

Logged In: YES
user_id=448016

Wow. Apparently I need a better prescription for my glasses. I I tried it
again (mind you, when I submitted it the first time I had tried it a few
times), and it worked perfectly.

Please accept my humble apologies. I don't know why I couldn't "see"
that I was not copying the code exactly.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant