Setting the value of True

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat Aug 24 21:27:00 EDT 2013


Steven D'Aprano wrote:
> As for why None, True and False are treated differently than built-ins, 
> if I remember the reason why, it is because they are considered 
> fundamental to the inner workings of Python, unlike mere builtins like 
> len, map, etc. and therefore should be protected.

It's probably more to permit optimisation. Treating them
as constants avoids a name lookup every time they're used.

-- 
Greg



More information about the Python-list mailing list