3 ms·
That's almost the exact same code as I thought, but it's an extension on c# and uses 'is Enumerable'. Which language is this?
by NicoJuicy 10y ago
That's almost the exact same code as I thought, but it's an extension on c# and uses 'is Enumerable'. Which language is this?
- contravariant 10y agoIt should work in python 3.3+, provided you make a method isIterable to detect whether something is an iterator or not. For lower versions of python you can't use the phrase 'yield from', so you need to iterate over flatten(y) manually and yield each element.