What I was hoping to share in my code example was not about generators. It is true that python2 doesn't allow to return values from generator functions, but plain return statement is allowed and is equivalent to `return None`.
Generators that I used in my code were just leftovers of my previous trials and experiments. They are not essential part of my idea. In fact in other thread I have already posted that their usage in this particular case isn't so good idea at all. Generators can be invaluable in situations when we need to operate on long lists, and here they return lists of one or zero elements. The same effect would be to replace yield statement with return [data...] and the other return with `return []`. I was hoping to pass the idea of using small functions that can be reasoned about in isolation instead of using set of classes which make code extremely hard to reason about. My toy example was written in about few hours, while I was simultaneously learning about ast module. I'll try to explain in more detail my point of view on classes/objects vs. functions in another thread with possibly more code examples. Vitalije -- 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.
