Speeding up permutations generation

Chris Angelico rosuav at gmail.com
Fri Mar 6 07:02:35 EST 2015


On Fri, Mar 6, 2015 at 9:33 PM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>> Is the actual generation of permutations your problem? You mentioned
>> that you're using itertools, so I would expect that you're simply
>> iterating over that; I hope you're not immediately trying to construct
>> a list of them all, because that would cost the memory that Mark's
>> response talks about. Have you actually profiled your code and found
>> that generating permutations is the bottleneck, or did you just guess?
>> Because even experienced programmers - even extremely experienced
>> Python programmers - are usually wrong when they guess about the
>> slowest part of a program. The only way to know is to measure.
>>
>> ChrisA
>>
>
> s/Mark/Wolfgang/ ?

Oops, yes, my bad. I read the rest of the thread, then went back up
and replied to the most appropriate post for what I wanted to say, and
then named the wrong person out of the two following posters. My
apologies, Mark and Wolfgang!

ChrisA



More information about the Python-list mailing list