Python Learning

Terry Reedy tjreedy at udel.edu
Sat Dec 16 16:09:06 EST 2017


On 12/16/2017 8:26 AM, Marko Rauhamaa wrote:

> Unfortunately, Python's indentation mechanism makes the REPL too
> frustrating an environment to type in even the simplest of function
> definitions, let alone a whole class.

The fundamental problem is that most REPLs are for 'command lines', and 
Python does not have 'command lines'.  It has statements.  A statement 
may consist of a single line, and if simple, it looks and acts like a 
command line.  But a statement may also be multiple lines.  Even without 
indentation, a single-line editing and history mechanism is a poor fit 
to a multiline statement language.

IDLE has a shell built for Python and Python only.  One enters, edits, 
and retrieves complete statements.  Indentation is automatic.  There is 
currently a glitch in that Shell indents with tabs instead of spaces, 
but I want to change that and know of two ways to do so.

-- 
Terry Jan Reedy




More information about the Python-list mailing list