Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52960

Re: Setting the value of True

From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: Setting the value of True
Date 2013-08-25 13:27 +1200
Message-ID <b7t4r6Fd6ufU1@mid.individual.net> (permalink)
References <9da851be-9ab3-4984-8f3e-71582f8ff4da@googlegroups.com> <521808ec$0$29986$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Setting the value of True jeangawron@gmail.com - 2013-08-23 16:38 -0700
  Re: Setting the value of True Gary Herron <gary.herron@islandtraining.com> - 2013-08-23 16:48 -0700
  Re: Setting the value of True Terry Reedy <tjreedy@udel.edu> - 2013-08-23 19:56 -0400
  Re: Setting the value of True Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-24 01:14 +0000
    Re: Setting the value of True Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-25 13:27 +1200

csiph-web