chivalry/exercism

Use generators/iterators in Flatten

Opened this issue · 0 comments

Follow mentor's suggestion of using generators and/or iterators to solve flatten.

https://github.com/chivalry/exercism-python/blob/master/python/flatten-array/flatten_array.py

I can suggest (again) to try using generators and/or iterators -- should be a good exercise if you're not so familiar with them. This solution can be turned easily into a recursive generator that wouldn't create intermediary lists -- I doubt it would be more efficient, though, but meh, it could be fun to write. Or try a non-recursive solution (with or without generators). If you need pointers let me know, but I'm pretty sure you won't.