Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
BerislavLopac
· 8y ago · 0 comments
It's not just repetitive; this particular example actually creates a list before starting the external loop -- imagine it with range(100000000) or something. It is better if you replace [] with (), which creates a generator.
Comments
[–]
Herald_MJ
8y ago
`range()` also takes an optional `step` argument which would help here.