PEP 308: some candidate uses cases from live code

Carlos Ribeiro cribeiro at
Sun Feb 9 20:09:35 CET 2003

On Sunday 09 February 2003 06:53, Tim Peters wrote:
> Me too, but note that it could be written (even in Python 1.0):
>     sy = d0.year - (d0.month < 7)
> That bools are confusable with 0 and 1 in Python is A Feature.

While I know it, and I've used it... it still does not seem the best thing to 
do in name of readability and maintainability. I prefer the conditional 
statement, because it clearly expresses the underlying logic, to any use of a 
side effect as mentioned above. But that's me, your mileage may vary.

[btw, I believe that this has something to do with the fact that my first 
language was Pascal, where the true=1/false=0 identity doesn't hold by 
definition. C programmers are more used to this idiom than I am]

Carlos Ribeiro
cribeiro at

More information about the Python-list mailing list