Are the critiques in "All the things I hate about Python" valid?

Ian Kelly ian.g.kelly at gmail.com
Tue Feb 20 12:17:12 EST 2018


On Tue, Feb 20, 2018 at 8:38 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Tue, 20 Feb 2018 15:23:44 +0100, Antoon Pardon wrote:
>
>>> Okay. Now create a constraint on a name in C++ such that it can only
>>> accept integers representing A.D. years which, on the Gregorian
>>> calendar, are leap years. (Using a dedicated integer-like type is
>>> permitted.) It must accept all multiples of four, except those which
>>> are multiples of one hundred, unless they're also multiples of four
>>> hundred.
>>>
>>> That's what Steve asked for. Can you do it? Or is the C++ type system
>>> not flexible enough for that?
>>
>> Steve had multiple contributions in this thread. I didn't react to the
>> one where he asked for that.
>
> Yes you did: you refused to meet the challenge, stating (and I quote):
>
> "Why should this be done at compile time?"
>
> https://mail.python.org/pipermail/python-list/2018-February/730995.html

I really don't understand what point you're driving at here, Steven.
The original claim (by you) was that dynamic languages excel at
"enforcing constraints at run-time which are hard to enforce at
compile-time". The counter-argument, as I understand, it was that
while the constraints may be hard to enforce at compile-time, they are
just as easy to enforce at run-time in a static language as in a
dynamic language, so that can't really be considered a *strength* per
se of dynamic languages. You then followed this up by issuing a
challenge to enforce this as a compile-type check in C++.

Obviously this has not been done [1], but just as obviously it could
not be done at compile-time in a dynamic language either, so I don't
see how any of this justifies your claim that being a static language
somehow makes constraints harder to enforce.

[1] But I have no doubt that it could be done in a language with a
sufficiently advanced type system. Just by way of example, the Haskell
wiki offers an example of quicksort implemented in the Haskell type
system: https://wiki.haskell.org/Type_arithmetic#An_Advanced_Example_:_Type-Level_Quicksort



More information about the Python-list mailing list