[Python-ideas] Inconsistencies (was: Shuffled)

Chris Angelico rosuav at gmail.com
Sat Sep 10 09:00:27 EDT 2016


Redirecting to python-list as I don't believe this belongs on -ideas.

On Sat, Sep 10, 2016 at 10:09 PM, Sven R. Kunze <srkunze at mail.de> wrote:
>> On 08.09.2016 04:00, Steven D'Aprano wrote:
>>
>> On Wed, Sep 07, 2016 at 11:43:59PM +0200, Sven R. Kunze wrote:
>>
>>> BUT experienced devs also need to recognize and respect the fact that
>>> younger/unexperienced developers are just better in detecting
>>> inconsistencies and bloody work-arounds.
>>
>> That is not a fact. It is the opposite of a fact
>>
>
> You might have heard of: "There are no such things as facts, just opinions.
> Everything, we see is a perspective not the truth." See below, why this
> applies here as well.

Yes, I've heard that. It is false.

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?

>>  -- inexperienced
>> developers are WORSE at spotting inconsistencies, because they don't
>> recognise deep consistencies.
>
>
> Your example (default arguments) might make sense when going one or two
> level deeper. However:
>
>
> Is going deep really necessary at all?
>
>
> People program for different reasons, to have fun, to create value for
> others, to educate, or for reasons we both cannot even think of. Why should
> they leave their level? Because of you or me? Because they need to know what
> Turing-completeness means? What calling conventions are? I don't think so.
> They wanna solve problems and get things done whether or not they know every
> single bit of the language they use. If they decide to go deeper, that's
> wonderful, but if they don't, don't force them.
>
> So, an inconsistency at level 1 might be a **result of a consistency at
> level 0** BUT it nevertheless is and stays an inconsistency at level 1 no
> matter how sophisticated the consistency at level 0 is.
>
>
> And please note, some even want to go on level up, so inconsistencies at
> level 1 just plain suck then. People then simply don't care about how the
> current flows at cpu level or about your carefully handcrafted bits and
> pieces on level 0 which you are so proud of and which are so consistent
> there.

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.



More information about the Python-list mailing list