A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/020772.html below:

[Python-Dev] For review: PEP 285: Adding a bool type

[Python-Dev] For review: PEP 285: Adding a bool type [Python-Dev] For review: PEP 285: Adding a bool typeHans Nowak wurmy@earthlink.net
Fri, 8 Mar 2002 13:12:25 -0500
This may be a minor issue, but this proposal will break code like

  days_feb = 28 + isleapyear(year)

assuming that booleans cannot be added to ints. :-)

isleapyear can be defined like this:

  return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

like it is in calendar.py. In the new situation it would return a boolean. Now 
I realize that code using isleapyear this way is easily fixed (especially if 
we would be able say int(True) or int(False) to get the numerical value 
again), but my point is, it takes away a (IMHO) nice side effect of using 
these values as numbers.

I'm not sure if there's a lot of code out there that actually uses these 
numerical values. I occasionally use it, though... I guess that's what I get 
for bad programming practices. :-)

--Hans Nowak (vaporeon@wanadoo.nl)
http://www.awaretek.com/nowak/



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4