Threading with queues

Lie Ryan lie.1296 at gmail.com
Tue Dec 22 13:35:44 EST 2009


On 12/22/2009 10:47 AM, Gib Bogle wrote:
>> This is indented over one indentation level too much. You want it to
>> be at the same level as the for above. Here, its at the same level
>> with "t" -- meaning this entire loop gets repeated five times.
>>
>> I sorta really recommend a tab width of 4 spaces, not 2 :) At 2, its
>> _really_ hard (especially if you're newer to Python) to see these
>> kinds of issues and since indentation is program logic and structure
>> in Python, that's bad... especially since your comment is indented to
>> the right level, but the code isn't :)
>>
>> --S
>
> It turns out that this code isn't a great demo of the advantages of
> threading, on my system anyway. The time taken to execute doesn't vary
> much when the number of threads is set anywhere from 1 to 6.

it does in mine:

Elapsed Time: 7.47399997711 (with one thread)
Elapsed Time: 1.90199995041 (with five threads)

what sort of weird machine are you in?



More information about the Python-list mailing list