[Edu-sig] RE: Rationals

Kirby Urner urnerk@qwest.net
Fri, 11 Oct 2002 14:31:09 -0700


>Could Python officially support multiple "numeric modes"? They could be
>called with various flavors of "-Q" or some other command-line option:

I don't personally like using switches to change behavior, as
then you can't just cut and paste code and run it -- you have
to know which "-Q" is being used.

>(Actually, I'd rather see 3/2 raise an exception in "integer mode",
>since the set of integers is not closed with respect to division -- kind
>of like dividing by zero. And what the heck -- for elementary school
>kids, there could be a "natural number mode", where the expression "3 -
>5" would raise an exception.)
>
>-John

As Danny Yoo pointed out, ML takes this route.  But I think it's
OK for non-closure to open a door to another type automatically,
just as ordinary ints now create longs when int boundaries are
exceeded (textbook math doesn't know about "int boundaries" --
but this is computer science, with math a backseat driver).

Kirby