Slices time complexity

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed May 20 01:33:58 EDT 2015


On Wednesday 20 May 2015 14:30, Marko Rauhamaa wrote:

> Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> 
>> There is a little magic elf hiding inside the computer, and when you
>> type an expression like '2 + 3', little tiny hammers bang it out in
>> Morse Code on the elf's head; in response, the elf calculates the
>> answer on his teeny tiny abacus and passes it back to the interpreter.
> 
> That would be a perfectly valid semantic explanation if it really
> predicted the output.

Which it does. State any mathematical expression involving operators and 
operands supported by Python, and I can express it in Morse code, and tell 
you exactly what result the elf will calculate.

Someone sufficiently killed with an abacus can probably even calculate it 
*using the same algorithms* that the elf will use. Being hit on the head by 
hammers is not compulsory.


>> Since this explanation explains the observed behaviour, according to
>> you it is equally valid as one involving, you know, actual facts.
> 
> It doesn't explain the observed behavior. It doesn't differentiate
> between correct and incorrect outcomes.

Perhaps when I wrote "the elf calculates the answer" it was unclear that I 
meant the *correct* answer rather than some arbitrary value which is not 
actually the answer. I will try to be more clear in the future.


-- 
Steve




More information about the Python-list mailing list