On 9/6/2012 9:43 AM, Alex wrote:
On Saturday, 25 August 2012 04:03:52 UTC+5:30, Alex wrote:
I'm new to Python and have been using IDLE 3.2.3 to experiment with
code as I learn. Despite being configured to use a 4 space
indentation width, sometimes IDLE's "smart" indentation insists
>>> upon using width-8 tabs.
[snip]
Agreed. I like PyDev in Eclipse, but sometimes I just want to try out
something quick in the interpreter, to ensure I understand it or do a
quick experiment.
You have two choices that come with the distribution: the console and
IDLE. I prefer IDLE. IPython and other shells and IDEs are other choices.
Since indentation is syntactically significant in
Python, I think fixing the interpreter to produce good, readable,
cut-and-pasteable, and Pythonic code is more important than a cosmetic
feature, but less important than true bugs.
IDLE is not the interpreter. As I said before, the IDLE editor *already*
does what you want. The IDLE Shell is intended mainly for single-line
inputs. For compound statements, it does automatic indenting, unlike the
console (at least not on Windows). It uses a tab to guarantee that the
code is visually indented. It does not use secondary prompts because a)
they would not line up anyway with proportional fonts and b) they would
appear in cut and paste copies. This probably count be improved, and has
been discussed, but someone has to volunteer to write a patch that shows
that it can be improved without introducing negative consequences. I
would test one if one appears.
For more than a three-line compound statement, I use the editor with a
scratchpad file where editing is *much* easier. If the compound
statement is a class or function definition, you need more statements
anyway to actually exercise the definition. Hitting F5 to run is as easy
as putting the cursor at the end of the statement and hitting Enter. And
it runs multiple statements at once, not just one.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list