Steven D'Aprano a écrit :
(snip)
> I mean, really, does anyone *expect* True+True to give 2, or that 2**True
> even works, 

I may be biased since I learned C before Python and learned Python 
before it had a Boolean type, but I'd think that having False==0 and 
True==1 is not that surprising for most programmers.

> without having learnt that Python bools are ints? I doubt it.
> 
> And the old Python idiom for an if...then...else expression:
> 
> ["something", "or other"][True]
> 
> tends to come as a great surprise to most newbies.

This idiom should slowly disappear now we have a clean syntax for such 
expressions.

> So I would argue that
> bools being ints is more surprising than the opposite would be.

I suppose this mostly have to do with one's background.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to