ANN: mxNumber -- Experimental Number Types, Version 0.2.0

M.-A. Lemburg mal at lemburg.com
Tue May 1 17:13:55 EDT 2001


Paul Moore wrote:
> 
> "M.-A. Lemburg" <mal at lemburg.com> writes:
> 
> > The 0.2.0 release is an alpha release. Everything is still in flux, so
> > expect bugs, strange behaviour etc.
> 
> >python
> ActivePython 2.1, build 210 ActiveState)
> based on Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import mx.Number
> >>> mx.Number.Integer(1500) <= 1
> 1
> >>> mx.Number.Integer(1500) <= mx.Number.Integer(1)
> 0
> 
> Does this count as "strange behaviour"? Surely mx.Number.Integer
> values should compare properly with Python integers?

They do... I get these results with stock Python 2.1:

>>> from mx.Number import *
>>> Integer(1500) <= 1
0
>>> Integer(1500) <= Integer(1)
0

but something is still not working right:

>>> Integer(1500) <= Integer(2000)
1
>>> Integer(1500) <= 2000
0
>>> Integer(1500) <= 2000L
0
>>> Integer(1500) <= 20000
0
>>> Integer(1500) < 20000
0
>>> Integer(1500) > 20000
1

Digging a little deeper in Python's (new) compare code, it seems
that a few bits of my coercion patches did not make it into the
core -- numbers are still coerced before comparing them; which
fails for mx.Number types since they don't define a coercion
function.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/




More information about the Python-list mailing list