alternatives alwayskeep it simple unless it must be complicatedon the other handspace and timeconcisenessexpressiveness that being saidthere are specific use cases that generators can address well they can reduce memory footprint in some programsreduce delays in othersand can occasionally make the impossible possible considerfor examplea program that must produce all possible permutations of nontrivial sequence since the number of combinations is factorial that explodes exponentiallythe preceding permute recursive list-builder function will either introduce noticeable and perhaps interminable pause or fail completely due to memory requirementswhereas the permute recursive generator will not--it returns each individual result quicklyand can handle very large result setsimport math math factorial( from permute import permute permute seq list(range( ) permute (seq seconds on ghz quad-core machine creates list of numbers len( ) [ ] [ ( [ ][ ]in this casethe list builder pauses for seconds on my computer to build -millionitem listbut the generator can begin returning results immediatelyp permute (seqnext( [ next( [ returns generator immediately and produces each result quickly on request list(permute (seq) = true about secondsthough still impractical same set of results generated naturallywe might be able to optimize the list builder' code to run quicker ( an explicit stack instead of recursion might change its performance)but for larger sequencesit' not an option at all--at just itemsthe number of permutations precludes building results listand would take far too long for mere mortals like us (and larger values will overflow the preset recursion stack depth limitsee the preceding the generatorhoweveris still viable--it is able to produce individual results immediatelymath factorial( permute (list(range( ))next( permute is not an option here[ generator functions and expressions