Am Mittwoch, 13. Dezember 2017 22:28:50 UTC+1 schrieb Edward K. Ream:

def a_generator():
>     if 0:
>         yield 'abc' # Makes the function a generator
>     return None
>

This only works with Python 3. Python 2  does not support mixing return and 
yield.
 It's also overcomplicated. a_generator is just an empty function, doing 
nothing to the list. But in this case you could also just use an empty 
list. aList.extend([]) or aList.extend(list()) are doing the exact same, 
while working out of the box everywhere.

for node in ast.walk(root):
>     classes_list.extend(do_class(node))
>

Proper way to handle this is

classes_list.extend(do_class(node if node else []))

or

for node in ast.walk(root):
    if node:
        classes_list.extend(do_class(node))

-- 
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