[Python-Dev] Inconsistent script/console behaviour

Guido van Rossum guido at python.org
Sat Sep 24 01:32:30 CEST 2011


On Fri, Sep 23, 2011 at 4:25 PM, anatoly techtonik <techtonik at gmail.com> 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.

You can't fix this without completely changing the way the interactive
console treats blank lines. None that it's not just that a blank line
is required after a function definition -- you also *can't* have a
blank line *inside* a function definition.

The interactive console is optimized for people entering code by
typing, not by copying and pasting large gobs of text.

If you think you can have it both, show us the code.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list