[Python-ideas] bool keyword: (was [Python-Dev] bool conversion wart?)

Ron Adam rrr at ronadam.com
Sat Mar 3 04:38:54 CET 2007


Josiah Carlson wrote:
> Ron Adam <rrr at ronadam.com> wrote:
>> So I have no problem if it's ruled out on the grounds that 'there is not 
>> sufficient need'
> 
> Ok.  YAGNI.  Seriously.  The performance advantage in real code, I
> guarantee, isn't measurable.  Also, the inconsistancy is subjective, and
> I've never heard anyone complain before.
> 
>  - Josiah

You are right.  It's more cosmetic than actual.  I basically said that from 
the start.

Not as a direct complaint, no.  It turns up more as a misunderstanding of 
how 'and' and 'or' work or a misunderstanding why bool returns what it does 
instead of what someone thinks it should, as in the thread that started 
this last week.  This addresses that in a subtle indirect way by redefining 
bool as an operator.  Weather or not it would actually improve the ease of 
understanding how python uses and interacts with boolean types and 
operators, I'm really not sure.

As far as performance gain, I was thinking that in combination with making 
True and False constants, it might be greater.  But it may very well not 
be.  Maybe sometime in the near future I will try to test just how much of 
a difference it could make.  In any case the making of True and False into 
constants is still an open python 3k issue.

This was more exploratory and since nobody else jumped in and took it up, 
it seems it would be un-popular as well.  But it's here for the record in 
any case.

Cheers,
   Ron



More information about the Python-ideas mailing list