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


Groups > comp.lang.python > #52960

Re: Setting the value of True

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: Setting the value of True
Date Sun, 25 Aug 2013 13:27:00 +1200
Lines 11
Message-ID <b7t4r6Fd6ufU1@mid.individual.net> (permalink)
References <9da851be-9ab3-4984-8f3e-71582f8ff4da@googlegroups.com> <521808ec$0$29986$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net pObW5tuLDUk2HNsaxp7MQQCP5iuhAWPUCCeoKSat/v4V60mfTh
Cancel-Lock sha1:/83yweHpF37ijybgqT33v7DTUIQ=
User-Agent Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
X-Accept-Language en-us, en
In-Reply-To <521808ec$0$29986$c3e8da3$5496439d@news.astraweb.com>
Xref csiph.com comp.lang.python:52960

Show key headers only | 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