On Wednesday, December 13, 2017 at 3:28:50 PM UTC-6, Edward K. Ream wrote:

There are several coding patterns in Vitalije's prototype that deserve 
> mention.
>

*Generators as predicates*
>
> Vitalije's prototype (as modified in leoCheck.py) contains this:
>
> for node in ast.walk(root):
>     classes_list.extend(do_class(node))
>

Similar code works for dicts. This code:

def gen():
    for i in range(2):
        s = str(i)
        yield ('file'+s, 'val'+s)
    return None

d = {}
d.update(gen())
g.printDict(d)

prints:

{
  file0:'val0',
  file1:'val1'
}

This is likely to come in handy in rewriting the ShowData class.

Edward

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to