[Python-Dev] Inconsistent script/console behaviour

Terry Reedy tjreedy at udel.edu
Sat Sep 24 01:49:53 CEST 2011


On 9/23/2011 7:25 PM, anatoly techtonik wrote:
> Currently if you work in console and define a function and then
> immediately call it - it will fail with SyntaxError.
> For example, copy paste this completely valid Python script into console:
>
> def some():
>    print "XXX"
> some()
>
> There is an issue for that that was just closed by Eric. However, I'd
> like to know if there are people here that agree that if you paste a
> valid Python script into console - it should work without changes.

For this kind of multi-line, multi-statemenmt pasting, open an IDLE edit 
window for tem.py (my name) or such, paste, run with F5. I have found 
that this works for me than direct pasting.

A interactive lisp interpreter can detect end-of-statement without a 
blank line by matching a closing paren to the open paren that starts 
every expression.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list