4 ms·
To generate a list/dictionary/geneator from an input iterable, you use a comprehension of the appropriate type. To iterate through it without doing one of thos
by dragonwriter 5y ago
To generate a list/dictionary/geneator from an input iterable, you use a comprehension of the appropriate type.
To iterate through it without doing one of those things, you use a for loop.
In “one obvious way to do it”, “it” refers to a concrete task; the same is not necessarily intended to be true of arbitrarily broad generalizations of classes of tasks.