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

AK andrei.avk at gmail.com
Wed Apr 2 14:50:10 EDT 2008


Terry Reedy wrote:
> "AK" <andrei.avk at gmail.com> wrote in message 
> news:47f2d018$0$6517$4c368faf at roadrunner.com...
> 
> || I'll be glad to hear comments/suggestions/etc:
> |
> | http://www.lightbird.net/py-by-example/
> 
> Using - as the example/return delimiter does not work.
> If you do not want to substantially lengthen the document by going to
> 
>>>> sqrt(9)
> 3
> 
> then use Python's a comment symbol.
> 
> sqrt(9) # 3
> -or-
> 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
> 
> 
> 
> 
> 
> 
> 

Thanks to everybody who replied, I will implement the change as per 
Terry's advice. I'm still considering whether to use the standard 
interpreter syntax, i.e. >>> ... \n result; my reason for not doing that 
is that I will often have a whole screen of function / result lines and 
if I were to add a new line for the result, that'd make two pages out of 
one, which I think is a bit too much. In current docs there are not so 
many examples, so that space is not multiplied quite so much, and using 
  interactive interpreter way of showing result is not nearly as much of 
a problem. However, I'm still thinking this over and it seems that 
almost everyone wants to see it done in that way, I might still go for 
two lines. I'll also be posting updates as the work progresses..

thx,

-- 
  -ak
   Tobu | http://www.lightbird.net/tobu/ | Freeform DB / Tagger / PIM
   Python-by-Example | http://www.lightbird.net/py-by-example/ | Guide 
to LibRef



More information about the Python-list mailing list