PEP 285: Adding a bool type

Mark McEahern marklists at mceahern.com
Wed Apr 3 08:35:20 EST 2002


[Robin Becker]
> C is a very successful language. I don't think of its conditional
> testing as a hack, but then I'm an engineer. What works is good and
> Python's current conditional testing seems to work very well and
> moreover efficiently in many cases of interest.
>
> Forcing all these into the (true, false) set using a Boole (if we're
> going to honour the man let's spell him right) variable seems to put too
> much emphasis on formalism. It also ignores the eminent sense of not
> fixing unbroken things and not adding yet another current to the Python
> type cake.

How is the PEP "forcing" anything?

As far as I can tell, the PEP simply means that I can do something like
this:

	def isPaid(account):
		...
		return True

without having to define my own silly truth/bool/boole (whatever the hell
you want to call it) constants.

Now, whether I should instead design this function like so:

	def paidThroughDate(account):
		...
		# someDate might actually be None
		return someDate

is a different matter.  And even if I did the latter, nothing about the PEP
means I can't still do this:

	if not paidThroughDate(account):
		...
	else:
		...

So where's the problem?

I'm still totally +1 on this PEP.  Of course, maybe all the subtle
objections raised are simply way over my head.

Cheers,

// mark





More information about the Python-list mailing list