HELP: restore my faith in Python

Johann Hibschman johann at
Sat Mar 4 18:59:19 CET 2000

Michael Hudson writes:

> Moshe Zadka <moshez at> writes:
>> That's it. I've given up on trying to understand you. What should 
>> 1/2 do?
>> 1. It can't return 0.5 -- floating point sucks
>> 2. It can't return Rational(1, 2) -- rational arithmetic blows up
>> 3. It can't return 0 -- integer division is confusing

> The example's a bit contorted because literals *do* get promoted, but
> the message is: don't divide `Int's.  I think the philosohpy is less
> of the principle of least surprise, more of the principle of early
> errors, i.e. (/) isn't really meaningful for integers (as you pointed
> out) so it's best not to allow it at all - you have to say what you
> mean if you want to do this.

> Not an option for the programming language that wants to become part
> of CP4E, probably.

I can see the FAQ now...

   Q1.1.2.3: Why can't I divide integers?
   A: You drooling moron!  You need a 10-page owners manual and
   instructional video to handle the notational complexity of
   Tic-Tacs, don't you?  As every schoolboy knows, the integers are a
   *ring*, not a field, you simpering simpleton.  Oh wait!  Let me
   guess!  I have to spell it out for you, you festering wombat boil.
   You can't divide integers by integers and get integers.  Understand
   now?  Now go out there and don't do it.  And read Herstein, while
   you're at it.

Hmm.  That might be more of an ML thing...  Scheme can already do it
right, but otherwise, they'd be all over it, like a cheap suit.  Maybe
if Perl had a kid with Smalltalk and they kept all the bad features,
maybe.  :-)


(By the way, I use Scheme a lot and all my shell one-liners are in
Perl.  Flames will be met with orbital bombardment.  I know where the
EUVE satellite control room is.)

Johann Hibschman                           johann at

More information about the Python-list mailing list