[Python-Dev] hash comments in interactive interpreter

John Belmonte john at neggie.net
Fri May 21 11:07:28 EDT 2004


Hello,

I'm wondering what the rationale is for hash comments yielding a 
continuation prompt (PS2) in the interactive interpreter.  I'd like to 
put such comments in interactive examples, but the output is hard to follow:

   >>> a = 5
   >>> # and now for some multiplication
   ...
   >>> a * 10
   50

What I would prefer can, ironically, be shown by the interactive 
interpreter emulator:

   >>> import code
   >>> code.interact()
   Python 2.3.3 (#2, May  1 2004, 06:12:12)
   [GCC 3.3.3 (Debian 20040401)] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   (InteractiveConsole)
   >>> a = 5
   >>> # and now for some multiplication
   >>> a * 10
   50

Another apparent inconsistency is that end of line comments don't behave 
this way:

   >>> a = 5
   >>> a * 10  # end of line comment
   50

Is there something preventing this anomaly in the interactive 
interpreter from being corrected?

-John


-- 
http:// ift ile.org/




More information about the Python-Dev mailing list