Y
Hacker News
new
|
ask
|
show
|
jobs
by
kiidev
1727 days ago
Isn't that going to be even slower, since a 156mb file would probably make gc_lines a very big tuple before summing it?
2 comments
makapuf
1727 days ago
You could do gc=sum(1 for _ on lines if ...) or use Counter
link
henbruas
1727 days ago
gc_lines isn't a tuple here, it's a generator expression. It will be lazily evaluated.
link