PEP 285: Adding a bool type

John Roth johnroth at ameritech.net
Mon Apr 8 07:59:00 EDT 2002


"David Eppstein" <eppstein at ics.uci.edu> wrote in message
news:eppstein-CB6351.08534907042002 at news.service.uci.edu...
> In article <ub0k49taktp243 at news.supernews.com>,
>  "John Roth" <johnroth at ameritech.net> wrote:
>
> > > By the way, this is conceptually very similar to ints (at least,
> > > nonnegative ints): ints answer a specific question: how many
things?
> > > They do not answer the question: which things are they.
> >
> > Not exactly. Consider the common case of 'take a number'
> > played at various burocracies. The manager can tell how many
> > there are by inspecting the next number on the roll, but each person
> > waiting has his own number, and they can be called out of order.
>
> I was talking about cardinal numbers, you're talking about ordinal
> numbers.
>
> Ordinal numbers in programming are often used for converting objects
> into positions to look up data in an array.  They're less often needed
> in Python because we have dictionaries instead.

Ints are neither cardinal nor ordinal. They just are. Cardinal and
ordinal are ways of analyzing the situation that may, or may not,
apply.

That said, I've come to the conclusion that Nicholas Wirth
had it right all along in Pascal, the way he handled enums and
sets. His style of enums can be used as indexes, and eliminate
the problem of relatively anonymous integers being used as
'magic numbers.'

Unfortunately, I don't see a PEP on enums. Maybe I should
dust off the rewrite of the set PEP I made that included them.

John Roth
>
> --
> David Eppstein       UC Irvine Dept. of Information & Computer Science
> eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/





More information about the Python-list mailing list