[Python-ideas] Inconsistencies

Sven R. Kunze srkunze at mail.de
Sun Sep 11 16:30:07 EDT 2016


On 10.09.2016 15:00, Chris Angelico wrote:
> Some things are absolute hard facts. There is no way in which 1 will
> ever be greater than 2, ergo "1 is less than 2" is strictly true, and
> not a matter of opinion. If you hear someone trying to claim
> otherwise, would you let him have his opinion, or would you treat it
> as incorrect?

I don't know exactly if it's clear that one would need to make a 
distinction between real/physical-world facts and pure-logic facts.

"1 < 2" is by definition "true" (construction of natural numbers) not by 
real-world evidence. IIRC, the quote is about real-world matters.

> There is some merit in this. For instance, Python 2 had a lower-level
> consistency in the division operator than Python 3 has. According to
> Py2, integers and floats are fundamentally different beasts, and when
> you divide an int by an int, you get an int, not a float. Py3 says
> "well, you probably REALLY meant to divide a number by a number", so
> it gives you a float back, unless you explicitly ask for floor
> division.
>
> Py2 is more consistent on a lower level of abstraction. Py3 is more
> consistent on a higher level of abstraction (modulo the oddities at
> extremely large numbers). Both have merit, but in a high level
> language, the Py3 way is usually [1] better.
>
> But the consistency of call-by-object-reference is at the same high
> level as the consistency of call-by-value or call-by-name. I can
> explain Python's assignment model to someone fairly easily, using
> pencil and paper, without any reference to "low level" or "high level"
> concepts. And Python is extremely internally consistent; *every*
> assignment behaves the exact same way. How does "import x" compare
> with "from x import y"? Easy: the former is "x = some_module_object",
> and the latter is "y = some_module_object.y", and either way, it's
> regular assignment. How does parameter passing work? You take the
> value of the argument as evaluated in the caller, and assign it to the
> parameter in the function. What about default arguments? They're
> evaluated when the function's defined, and assigned to the parameter
> when it's called. Function definition itself is the same thing - it's
> assigning a function object to a name. Python handles every one of
> them the same way.
>
> I don't care one iota about how voltages inside a CPU operate. I don't
> generally even care about machine code - let other people worry about
> that, people more expert than I am. Discussions about how the core dev
> and the novice see Python's consistencies are nothing to do with those
> levels. To go back to your original point, that a newbie is better at
> recognizing inconsistencies... maybe, in a sense, but they also get a
> lot of false positives. Ultimately, "consistent" means that there's a
> single pattern that explains everything; if you're unaware of that
> pattern, you won't know that it's consistent.
>
> ChrisA
>
>
> [1] Even in Python, there are places where low-level consistency is
> better, because Python is a glue language. But in general, it's better
> for Python to be consistent with humans than with C APIs.

The last sentence is the part why I love Python.  :)

I could not agree more with what you said above, so I hope this will put 
the discussion in better perspective, especially when people here trying 
to be overly absolute in their views (which was the quote about).

Cheers,
Sven




More information about the Python-list mailing list