PEP 285: Adding a bool type

John Roth johnroth at ameritech.net
Sat Apr 6 10:27:25 EST 2002


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:Npor8.8281$q63.818 at atlpnn01.usenetserver.com...
> "Cliff Wells" <logiplexsoftware at earthlink.net> wrote in message
> news:mailman.1017865089.20676.python-list at python.org...
> > On Tue, 2 Apr 2002 21:21:27 -0500
> > John Roth wrote:
> >
> > >
> > > "Laura Creighton" <lac at strakt.com> wrote in message
> > > news:mailman.1017755045.4308.python-list at python.org...
> > > > Dear Guido:
> > > >
> > > > I would first like to thank you for giving us an opportunity to
> > > respond.
> > > > I have spent most of the weekend thinking and writing a reply to
this,
> > > > and I think that this has made me a better teacher.  For this I
am
> > > > grateful.  I realise that this is rather long, but I have
condensed
> > > > it substantially from my efforts earlier this weekend.   Thank
you
> > > > for taking the time to read this.
> > > >
> > > > Laura Creighton
> > > >
> > > > -----------------------------
> > > >
> > > I'm not going to quote this, as it's already too long. I read up
to
> > > the diatribe on the Swedish leap year, and I went AAAARRRRGGGH!
> > >
> > > I really don't care if you want the silly function to return
> > > a Boolean, the number of leap days in the year, or the name
> > > of the idiot parliamentarian who decided to fix the calendar
> > > so that 1712 was different from the rest of Europe.
> > >
> > > HOWEVER, if you want true or false as the return
> > > value, the name should be something like 'isLeapYear()'.
> > > If you want the number of leap days in the year, then
> > > it should be named something like 'numberOfLeapDays().'
> >
> Just so John know he isn't the only person going AARRGGHH, I read this
went
> AARRGGHH myself. It should not be named "something like
> 'numberOfLeapDays()'". It should be named LeapDays(), or possibly
> LeapDayCount() if you also have a function that returns the actual
dates
> which ARE the leap days. Or, I suppose, you could call it
> "theNumberOfLeapDaysInTheSwedishYear()" ;-)

Any of these would be acceptable. In practice, if I was working
on a project with you, I would accept any of those suggestions.
My objection, pure and simple, was that isLeapYear() requires
a boolean return, and hence is not something that you do
arithmetic to, regardless of the fact that Python permits it.

> > > Sorry to make this sound like a flame, but I try to
> > > practice XP. The first time I ever come across a
> > > function named "isSomething" that returns a conceptual
> > > integer, it's going to get refactored, right then and
> > > there to a name that actually expresses what it does.
> >
> People who live in glass houses ...

Oh?

John Roth






More information about the Python-list mailing list