Re: Generator expressions v/s list comprehensions
A small correction:
Martin DeMello wrote:
[color=blue]
> Here's a simple example
>
> linecount = sum(1 for line in file)
> linecount = sum([1 for line in file])
>
> The former requires an in-memory list equal to the size of the file.[/color]
^^^^^^
I think you meant "the latter"...
[color=blue]
> Consigning "other than memory consumption" to a parenthetical remark
> misses its importance.[/color]
-Peter
A small correction:
Martin DeMello wrote:
[color=blue]
> Here's a simple example
>
> linecount = sum(1 for line in file)
> linecount = sum([1 for line in file])
>
> The former requires an in-memory list equal to the size of the file.[/color]
^^^^^^
I think you meant "the latter"...
[color=blue]
> Consigning "other than memory consumption" to a parenthetical remark
> misses its importance.[/color]
-Peter
Comment