> > Unlike all my recursive attempts, this iterative solution effortlessly > inserts new nodes. > > This solution may look like iterative, but it just hides the recursion inside moveToThreadNext. Effectively the recursion is implemented by hand using p.stack instead of the true recursion implemented by using the Python stack.
Have you tested it for speed? I really doubt that it would gain any speed improvements. I don't know against which other implementation you compare the speed, but I am almost 100% certain that it would be far slower than using recursion directly on v-nodes. I would expect this script to be slower than the naive recursive implementation using recursive calls. The solution implemented by using Python generators directly on v-nodes (at least in my experience) is the fastest. -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/1072cf64-dc71-4112-b2f0-07b95118a020n%40googlegroups.com.