[Tutor] A fun puzzle

Kent Johnson kent37 at tds.net
Fri Aug 24 21:12:15 CEST 2007


Dick Moores wrote:
> At 10:22 AM 8/24/2007, Kent Johnson wrote:
>> So you actually pasted that code into timeit.py?
> 
> Yeah. :-( I think I learned on the Tutor list to do it that way, but I'm 
> not sure. Thanks for showing me a correct way.

I hope not!

>> Using timeit more conventionally I get unsurprising results. This 
>> program has output:
>> 0.497083902359
>> 0.359513998032
>>
>> which is more in line with what I would expect.
> 
> Using your exact code, I just got
> 0.737564690484
> 1.17399585702
> 
> Which is the reverse of your result, but on a slower computer. What's up 
> with that??

I have no idea. Some strange interaction with the memory cache? I'm 
running Python 2.5.1 on a MacBook Pro (Intel Core 2 Duo processor). How 
about you?

Time for one of the über-wizards to chime in, maybe :-) or post the code 
and results on comp.lang.python and see what they say there.

Kent


More information about the Tutor mailing list