Python-by-example - new online guide to Python Standard Library

Terry Reedy tjreedy at
Wed Apr 2 19:12:57 CEST 2008

"AK" <andrei.avk at> wrote in message 
news:47f2d018$0$6517$4c368faf at

|| I'll be glad to hear comments/suggestions/etc:

Using - as the example/return delimiter does not work.
If you do not want to substantially lengthen the document by going to

>>> sqrt(9)

then use Python's a comment symbol.

sqrt(9) # 3
sqrt(9) # returns 3 (but I think I prefer the first)

which clearly is not an arithmetic expression and which can be 
cut-and-pasted into the interactive interpreter.  This also works nicely 
for invalid examples.

sqrt(-9) # raises ValueError

Terry Jan Reedy

More information about the Python-list mailing list