Slices time complexity
Marko Rauhamaa
marko at pacujo.net
Tue May 19 11:59:21 EDT 2015
Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> To be useful, explanations ought to give the user *predictive power*
> -- if I calculate 32767 + 1, what will Python do?
>
> Explanation #1 predicts that Python will return 32768.
> Explanation #2 makes no prediction at all.
Any semantic ruleset that correctly predicts the behavior of any given
Python program is equally valid.
> Only one of these models for Python allows you to make correct
> predictions, even though all three explain the observations given.
You're slaying straw men.
>> For example, you could explain Python's object references as pointers
>> (memory addresses) if you considered that helpful. (That's how Lisp
>> textbooks often explain cons cells.)
>
> Well, you could do that, but it would fail to explain the behaviour of
> Jython and IronPython.
Jython, CPython and IronPython are supposed to be semantically
equivalent. So any valid CPython model is also a valid model for Jython
and IronPython.
Coincidentally:
The reference values (often just references) are pointers to these
objects, and a special null reference, which refers to no object.
<URL: https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.htm
l#jls-4.3.1>
(without any explanation as to what a "pointer" might be).
> Mixing descriptions of a specific implementation with descriptions of
> the high level semantics is sometimes useful but often misleading, and
> one needs to be careful how and when one does it.
Nobody has proposed doing that.
Marko
More information about the Python-list
mailing list