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

Antoon Pardon antoon.pardon at vub.be
Wed Feb 21 06:18:58 EST 2018


On 21-02-18 11:31, Terry Reedy wrote:
> On 2/21/2018 3:15 AM, Antoon Pardon wrote:
>> On 21-02-18 06:18, Terry Reedy wrote:
>>> On 2/20/2018 8:38 AM, Antoon Pardon wrote:
>>>
>>>> People praise the dynamic nature of Python here on this list and then
>>>> often enough seem to recoil when they see a piece of code really using
>>>> that dynamism.
>>>
>>> ...
>>>
>>> When makes people recoil is abusing dynamism by needlessly rebinding a
>>> name to objects of different specific type within a single block of
>>> code.
>>>
>> But that was what Steven was complaining about. The fact that in a
>> static language
>> He would need two names if he wanted a variable in a single block of
>> code to be
>> first a number and then a string. At least that is how I understood him.
>
> I am not a party to any dispute between you and Steven.

But that was still the context in which the above contributions were made.

>
> I intentionally inserted 'needlessly' in that comment to cover the
> situation where a competent Python programmer has at least a plausible
> reason for rebinding within a block.  But in Python, this is rare
> compared to the constant binding of parameters names to whatever
> argument one passes.

I find 'needlessly' is without real meaning here. What one person finds needless
an other finds interesting. What one finds annoying insertions to placate the
type system, an other finds an interesting way to make intentions clear and
an implicite way to let the runtime check boundareis when needed.

The designer of Python have made their choice, fine I can live with their choice
and a lot of people even seem happy with that choice. That is fine too. It doesn't
mean we need to react as if all can be said about the alternatives is how annoying
they are.

>
> Types indicate how to treat a particular object or, in some computer
> languages, a block of memory.  Declaring a type for a name that is
> permanently attached to an information entity is an indirect way of
> associating a type with the entity.  If entities are tagged with their
> type, then names need not be.
>
That they don't need to be, doesn't contradict it could be usefull. If I have the
intention that a certain name will only ever be bound to numeric values between -10
and +10. Then IMO it would be usefull if one could express this in the language and
let the language runtime do the needed checks each time this name is rebound.

It certainly would be less annoying than repeatedly having to insert the same extra
code that checks for these restraints.

-- 
Antoon.





More information about the Python-list mailing list