[IPython-user] Ruminations on Leo + IPython

Edward Ream edreamleo@yahoo....
Thu Jan 31 10:08:37 CST 2008


> I 
think 
it 
would 
be 
nice 
to 
have 
a 
"Hello 
World" 
example 
in 
the tutorial 
though.

It's been over a year since I looked at the tutorial.
With fresh eyes, I see that it might be good to
de-emphasize the literate programming features.
They could be off-loaded to a subsidiary page.
That would be a big improvement.

The hello world example would be something like this:

In any .leo file, create two nodes.

1. Root node:

headline: @thin helloWorld.py

body text:

@first #! /usr/bin/env python
@others
if __name__ == __main__:
    hello()

2. A single child of the root node:

headline: hello

body text:

def hello():
    print 'hello world'

Create these nodes, then save the .leo file.
This will create helloWorld.py in the same
folder as your .leo file.

You should be able to run helloWorld.py.

If you don't like the sentinels in helloWorld.py,
convert @thin to @auto.  You lose some flexibility
with @auto, however.

To reduce the complexity of sentinels, at the cost of less ability to use svn, change @thin to @file.

To eliminate all sentinels, at the cost of losing the
ability to update the .leo file automatically when
changing helloWorld.py in an external editor,
change @thin to @nosent.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edreamleo@yahoo.com
Leo: http://webpages.charter.net/edreamleo/front.html
--------------------------------------------------------------------




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20080131/6fbd60b9/attachment.html 


More information about the IPython-user mailing list