On Mon, Jan 18, 2010 at 2:02 PM, James Wilson <[email protected]> wrote:
> (1) Various of the code examples use print(), where I think they
> should use g.es(). For instance the following gives an invalid syntax
> error unless you replace print() with g.es():
>
> current = p.copy()
> print("inclusive parents of %s" % current.h,color="purple")
> for p in current.self_and_parents():
> print(p.h)
This is valid syntax in both Python 2.x and 3.x.
You may run into troubles with unicode characters unless you put
something like the following in python/Lib/sitecustomize.py:
import sys
sys.setdefaultencoding('utf-8')
But perhaps you just ran afoul of whitespace: see below.
> (2) At the top of the chapter it says that you can run all the code
> examples with CTRL-B. However, this assumes that the text explanation
> in the nodes is marked up with @doc. Otherwise Leo attempts to execute
> the explanation text as well as the code example, which will then
> frequently give a syntax error. I can see two potential remedies --
> either mark up the examples appropriately with @doc and @code, or
> remind readers to select the elements of the script they want to
> execute before pressing CTRL-B.
I've just added the following language to the introduction:
You may have to select the actual code to execute if a node contains
comments interspersed with the code.
Be careful when selecting code to include the leading whitespace of
the first line. Otherwise python will complain.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.