This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE cannot do example 4.1 in tutorial (if statements)
Type: behavior Stage: resolved
Components: Versions: Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: drbuckle, mark.dickinson, r.david.murray
Priority: normal Keywords:

Created on 2010-08-05 00:07 by drbuckle, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ISSUE_9519.rtf drbuckle, 2010-08-06 04:13 My answer to your question.
ISSUE_9519.txt mark.dickinson, 2010-08-06 21:09
Messages (10)
msg112930 - (view) Author: Robert Buckley (drbuckle) Date: 2010-08-05 00:07
In both Python 2.7 and 3.1 the IDLE is unable to handle example 4.1 in the tutorial (if statements). Works OK with the command line shell, but not the IDLE shell.
msg113063 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-06 02:52
Could you please be more specific?  What error are you seeing?  It works for me.
msg113072 - (view) Author: Robert Buckley (drbuckle) Date: 2010-08-06 04:13
See attached file
msg113135 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-06 21:02
rtf2html can't make anything out of that file, so I'm guessing it is some sort of image wrapped up as an RTF?  If that's so can you just post a jpg?  Better would be to cut and paste the Idle session text as text.
msg113136 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-06 21:09
Replacing RTF file with a plain text version.
msg113137 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-08-06 21:25
It appears that IDLE maintains the current indentation level, while the interpreter always resets indentation to the start of the line.  I don't really see why this is a problem.  In IDLE, when you want to unindent a level, you need to hit your backspace key.
msg113141 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-06 22:12
Yes, Mark is correct.  IDLE does auto-indentation, and you have to backspace to go up to the previous indentation level.
msg113146 - (view) Author: Robert Buckley (drbuckle) Date: 2010-08-07 00:22
Yes, thank you. Using BACKSPACE to unindent works when I am using an indented block inside a first or subsequent indented block, e.g., inside a simple funtion. That feature does not work, as illustrated in example 4.1, when using IDLE.
msg113148 - (view) Author: Robert Buckley (drbuckle) Date: 2010-08-07 02:30
I can say that more clearly. The backspace feature for ending a block does not work in IDLE when attempting to end a block that had no indentation. Example:
>>> if a < 4:
          a = 0 # Assume this is end of the 'if' block; that you want to
                # return to column 1, in line below the 'i'. The use of
                # BACKSPACE in IDLE will fail to achieve the desired
                # result and will cause ERROR.

Another example:
>>> if a < 4:
          a = 0
          while b < 7:
                a = a + b  # Assume this is end of 'while' block; that
                           # you want next line to begin directly below
                           # the 'w'. Use of BACKSPACE in IDLE will
                           # work correctly. But if you ultimately want
                           # to end the initial 'if' block, BACKSPACE
                           # will again fail and result in ERROR.
msg113150 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-07 05:04
Just like in the interactive interpreter, when you get to the end of a suite, you have to hit enter again to end the suite.  This is indicated in the example by the '...' with no other text on the line (i.e.: at that ... you press enter).  In Idle it is the same, except that there is no leading '...' in the interface, just a blank line.

The tracker isn't really the place to get help on using python or Idle.  The python-list mailing list is a good place to seek help.

But if you can see a way to improve the documentation to make this clearer, that would be welcome.  Please open a new issue for that, though.
History
Date User Action Args
2022-04-11 14:57:04adminsetgithub: 53728
2010-08-07 05:04:08r.david.murraysetstatus: open -> closed

messages: + msg113150
2010-08-07 02:30:11drbucklesetmessages: + msg113148
2010-08-07 00:22:36drbucklesetstatus: closed -> open

messages: + msg113146
2010-08-06 22:12:51r.david.murraysetstatus: open -> closed
resolution: not a bug
messages: + msg113141

stage: resolved
2010-08-06 21:25:22mark.dickinsonsetmessages: + msg113137
2010-08-06 21:09:51mark.dickinsonsetfiles: + ISSUE_9519.txt
nosy: + mark.dickinson
messages: + msg113136

2010-08-06 21:02:45r.david.murraysetmessages: + msg113135
2010-08-06 04:13:08drbucklesetfiles: + ISSUE_9519.rtf

messages: + msg113072
2010-08-06 02:52:55r.david.murraysetnosy: + r.david.murray
messages: + msg113063
2010-08-05 00:07:51drbucklecreate