Why sys.ps2 after interactive #-line?

Michael Hudson mwh at python.net
Sun Jun 24 18:58:48 EDT 2001


bokr at accessone.com (Bengt Richter) writes:

>  >>>
>  >>> # comment
>  ... # why ... at beginning of this line?
>  ... # and this, and the next?
>  ...
>  >>>
> 
> Why not a fresh sys.ps1 prompt after each #-line ?

Because That's The Way It Is.  The heuristics the Python prompt uses
to decide whether a statement typed interactively is finished are a
bit hairy.  They seem to work most of the time though.

> Just curious :)

Well, if you're *really* curious, you should probably read the
source...

Cheers,
M.

-- 
41. Some programming languages manage to absorb change, but
    withstand progress.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list