[Python-ideas] META: Is a PEP a good place to record Python's core design decisions and coding principles?
Jonathan Fine
jfine2358 at gmail.com
Sun Mar 24 13:16:22 EDT 2019
SUMMARY
I think we're about to have a discussion of what's appropriate to have on
this list, so I've started a new thread.
I formulate the question as: Is this list an appropriate place for the
discovery, discussion and application of Python's core design decisions and
coding principles? Or in other words, is a PEP an appropriate place to
record the outcome of such activities?
If you want to discuss further, this thread I suggest is the place to do
it. But I'd rather you suspended such contributions, until I have elsewhere
by example shown what I mean by the discover etc of Python's core
principles.
BACKGROUND
In "Why not ['a','b','c'].join(',') ?" Chris Angelico wrote:
> this is a topic for python-list, not python-ideas, unless someone
>
is proposing a change.
In response, I made and stated a bold statement. Namely that the Python
syntax for string join is a consequence of Python's core design decisions
and coding principles, together with the semantics of join. When I made
this statement, I was confident it was true.
ABOUT PYTHON PRINCIPLES
After further reflection, I realised that it applies more widely. I've also
discovered, applying the principle, a gap in the Python string module.
Right now and here is not a good time to talk about it, but YES, someone
will be proposing a change.
I've said recently on this list, at least once, that I'm a pure
mathematician. And that I'm trained to find a small, simple and elegant
system of rules which determine the behaviour of a large number of examples.
AN EXAMPLE - Roman and Arabic numbers
The Hindu-Arabic numeral system 1, 2, 3, 4, 5, ..., 9, 10, 11, ... were
developed in 1st to 4th centuries by Indian mathematicians. Addition and
multiplication of numbers, using this numeral system is much simpler than
using the earlier Roman numeral system I, II, III, IV, V, ..., IX, X, XI,
... .
This is part of the story of how the discovery and introduction of new
concepts made addition and multiplication much easier. By the way, from
about 500 to 630 a symbol that we now would call zero was introduced, and
understood. And today zero is mathematics for children, if not exactly
child's play.
While writing this, I consulted
https://en.wikipedia.org/wiki/Hindu%E2%80%93Arabic_numeral_system#History
FACTS, AXIOMS and THEOREM
Chris Angelico wrote:
> It's way WAY simpler than all this. "Iterable" isn't a type, it's a
> protocol; in fact, "iterable" just means "has an __iter__ method".
I think that for Chris this is a FACT about Python. This is the way Python
is.
My mathematical approach is to find simple AXIOMS for which have this FACT
is a logical consequence, or in other words a THEOREM. (Also we want the
axioms not to have wrong statements as a logical consequence.)
Here's an example to show how FACTS, AXIOMS and THEOREMS fit together. For
most of us, at grade school statements such are 2 + 2 = 4 and 7 * 8 = 56
are FACTS when summoned from memory. And 1 + 2 + 3 + 4 + 5 = 15 is a
THEOREM that arises from knowing how to add numbers (which for most
students is a collection of FACTS).
Now consider
X = 1 + 2 + 3 + 4 + 5 + .... + 99 + 100
That X == 5050 is a THEOREM based on the FACT of addition, together with a
laborious calculation. Once, a grade school teacher gave the calculation of
X as work for his student to do.
To the teacher's surprise, one of the students very soon came up to his
desk with the correct answer 5050. This grade school student had discovered
for himself the THEOREM, based on the fundamental properties of counting
number, that
1 + 2 + 3 + ... + (N-1) + N == N (N + 1) / 2
This student went on to be the greatest pure and mathematician and
theoretical physicist of his day.
https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss#Early_years
ASIDE
Mathematics is a special skill. All of us have our own special skills and
experiences, and most of us are not mathematicians. Our community code of
conduct encourages collaboration, so that all of our experiences and skill
sets can contribute "to the whole of our efforts".
With good will, we can overcome friction and misunderstanding between the X
and non-X communities, for the benefit of all. For all every special skill
X. Or in other words, many hands make light work, and many eyes find many
more bugs.
SUMMARY
I have argued that Python's core design decisions and coding principles
can, at least in part, be reduced to a system of AXIOMS that can be useful
applied. I have argued mainly based on analogy with the Hindu-Arabic
numeral system, and the life and work of Gauss.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190324/f61f1b29/attachment-0001.html>
More information about the Python-ideas
mailing list