anomaly

Antoon Pardon antoon.pardon at rece.vub.ac.be
Mon May 11 07:39:44 EDT 2015


Op 11-05-15 om 12:40 schreef Mark Lawrence:
> On 11/05/2015 11:15, Antoon Pardon wrote:
>> Op 10-05-15 om 19:28 schreef Gary Herron:
>>
>>> Common Python thought::  "We're all adults here."    If you want to
>>> override a builtin within your own namespace, who are we to stop you?
>>> Besides, it's still available as __builtins__.int  (unless you've also
>>> overridden that).
>>
>> This is a common python myth. That is selectively used when
>> convenient and
>> ignored when that is convenient.
>>
>> Try overriding None, True or False in python3 and see what happens.
>>
>
> According to
> https://docs.python.org/3/reference/lexical_analysis.html#keywords
> None, True and False are all keywords in Python 3, int isn't as I
> believe has already been pointed out.
>
Which is exactly the point! They were turned into keywords because the
developers didn't want to allow them being overridden. There is no
a priori reason why we should turn "True" into a keyword and allow
"int" in the builtins.

We are only allowed to be adults, for as far as the developers let us.
They allow us to be adults with regards to "int" but they don't allow
us to be adults with regards to "True".

Defending "int" being overridable by declating "We're all adults" is
being selective.

-- 
Antoon Pardon




More information about the Python-list mailing list