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

Antoon Pardon antoon.pardon at vub.be
Wed Feb 21 03:09:36 EST 2018


On 21-02-18 05:13, Steven D'Aprano wrote:
> On Tue, 20 Feb 2018 10:17:12 -0700, Ian Kelly wrote:
>
>> 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.
> To be perfectly frank, neither do I any more. I fear I've been suckered 
> into taking a position I didn't intend to, as often happens when I reply 
> to Antoon Pardon.
>
> Obviously both statically and dynamically typed languages are Turing 
> Complete, so any constraint you can apply at run-time in one you can 
> apply at run-time in the other. How *easy* that is depends on the 
> language features, and particularly for older languages, statically typed 
> languages tend to be harder and less convenient to write in. There's 
> typically more boilerplate, and more time spent placating the type-
> checker. Do I need to justify this or can we take it as a given?
>
> So I didn't think I was taking a controversial position to say that 
> dynamic languages are good for writing constraints that are enforced at 
> run-time, *as opposed to trying to do so within the type-system* which 
> was the topic under discussion.

Yes it is controversial. You seem to conflate "within the type-system"
with "at compile time". If you want to make a general statement of
dynamically typed languages vs statically typed languages, I don't think
you can do that. There are plenty of statically typed languages that
also do run time checks.

I didn't sucker you into a position. Your inaccurate wording suckered you
into a position.

-- 
Antoon.




More information about the Python-list mailing list