Jan-27-2017, 12:39 AM
Ok, it sounds like you're using Python 3.
Generators are lazy, so until you do something with them they represent more potential than work done. map() and comprehensions (syntactic sugar for maps) are ideal for cases where you're generating iterables of values to be used by something else, if you want side effects (e.g. printing, network stuff, reading / writing files) you should probably use an explicit for loop.
Generators are lazy, so until you do something with them they represent more potential than work done. map() and comprehensions (syntactic sugar for maps) are ideal for cases where you're generating iterables of values to be used by something else, if you want side effects (e.g. printing, network stuff, reading / writing files) you should probably use an explicit for loop.