int/long unification hides bugs

Antoon Pardon apardon at forel.vub.ac.be
Fri Oct 29 07:22:57 EDT 2004


Op 2004-10-28, Andrew Dalke schreef <adalke at mindspring.com>:
> Jeremy Fincher wrote:
>> The problem with int/long unification is that there is no simple
>> pure-Python alternative for those of us who need a bounded integer
>> type.  If our code depended on that raised OverflowError in order to
>> ensure that our computations were bounded, we're left high and dry
>> with ints and longs unified.  We must either drop down to C and write
>> a bounded integer type, or we're stuck with code that no longer works.
>
> What's wrong with the example Number wrapper I posted a couple days
> ago to this thread?  Here are the essential parts
>

What I think is wrong with it, is that it distributes its constraineds
too far. The fact that you want constraints on a number doesn't imply
that all operations done on this number are bound by the same
constraints

The way I see myself using constrains, would mean I need them on
a name, not on an object.

-- 
Antoon Pardon



More information about the Python-list mailing list