On Mon, Sep 7, 2009 at 3:05 AM, Edward K. Ream <[email protected]> wrote:
> The parallel with p.moveToThreadNext is exact. Clearly,
> p.moveToFirstChild, p.moveToNext and p.moveToParent are very fast, so
They are still a lot slower than (for nodes).
def walk(node):
for chi in par.children:
yield chi
if chi.children is not None:
for rec_chi in walk(chi): yield rec:chi
Note that there is no overhead for "self", or function calls (apart
from recursion), or list manipulation (unlike with p.move.... It's a
completely read-only generator.
--
Ville M. Vainio
http://tinyurl.com/vainio
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---