[Python-Dev] ANN: Experimental Number Types (Integer, Rational, Floats)

Ben Wolfson wolfson at uchicago.edu
Thu Apr 19 18:02:44 EDT 2001


In article <mailman.987712113.6506.python-list at python.org>, "M.-A.
Lemburg" <mal at lemburg.com> wrote:

> Michael Hudson wrote:
>> 
>> Before I d/l and take a look...
>> 
>> "M.-A. Lemburg" <mal at lemburg.com> writes:
>> 
>> > (e.g. Integer(2) + "3" works as one would expect ;-).
>> 
>> So it raises an exception?  Seriously, that's what *I'd* expect, and if
>> it's not what your package does, I beg you to reconsider.
> 
> Integer(2) + "3" gives you Integer(5). This is a side-effect of how the
> implementation converts arbitrary objects into ones usable for coercion:
> Integer(2) + "3" is interpreted as Integer(2) + Integer("3") which gives
> Integer(2) + Integer(3).
> 
> After having played with it for a while, I must say, that I kind of like
> it :-)
 
Just like Steve Lamb (right?  It was him, right?) wanted!  At long last,
Python can just do the right thing!  Even if it still seems like the
wrong thing.

-- 
Barnabas T. Rumjuggler
Thou hast been called, O Sleep!  The friend of woe,
But 'tis the happy who have called thee so.
 -- Robert Southey



More information about the Python-list mailing list