Setting the value of True

Gary Herron gary.herron at islandtraining.com
Fri Aug 23 19:48:33 EDT 2013


On 08/23/2013 04:38 PM, jeangawron at gmail.com wrote:
> Python allows you set the value of True
>
>>>> True = 1.3
> Now this is consistent with the decision to let you set the
> value of various builtin names.  But why is this case different:
>
>>>> None = 1.3
>    File "<stdin>", line 1
> SyntaxError: cannot assign to None
>
> Mark Gawron

Python3 fixes this inconsistency, by disallowing all such assignments.

They all raise an exception:
       SyntaxError: assignment to keyword





More information about the Python-list mailing list