Pythonic infinite for loop?

Chris Angelico rosuav at gmail.com
Fri Apr 15 11:35:37 EDT 2011


On Fri, Apr 15, 2011 at 10:52 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Fri, 15 Apr 2011 13:58:22 +1000, Chris Angelico wrote:
>
>> The dictionary is potentially a lot larger than this particular set of
>> values (it's a mapping of header:value for a row of a user-provided CSV
>> file). Does this make a difference to the best option? (Currently I'm
>> looking at "likely" figures of 60+ keys in the dictionary and 3-8
>> postage options to pick up, but both of those could increase
>> significantly before production.)
>
> SIXTY keys?
>
> When you get to sixty thousand keys, it might take a few seconds to
> process.

This whole code is inside a loop that we took, in smoke testing, to a
couple hundred million rows (I think), with the intention of having no
limit at all. So this might only look at 60-100 headers, but it will
be doing so in a tight loop.

ChrisA



More information about the Python-list mailing list