[issue6795] decimal.py: minor issues && usability

Stefan Krah report at bugs.python.org
Mon Sep 7 17:27:58 CEST 2009


Stefan Krah <stefan-usenet at bytereef.org> added the comment:

[...]
> But in Python this error condition *can* 'otherwise be indicated', by 
> raising a suitable Python exception.  So I propose changing the decimal 
> module in 2.7 and 3.2 so that int(Decimal('nan')) and 
> long(Decimal('nan')) raise ValueError.

Excellent analysis, I would be very much in favour of this.

> Issue 3. I can't see how this could cause any real problems, since you'd 
> get an error as soon as you tried to use a bogus context.  Further, an 
> explicit typecheck goes against Python's duck-typing philosophy:  a 
> suitably crazy and misguided person ought to be able to create their own 
> 'quacks like a context' class, not necessarily inheriting from 
> Decimal.Context, and pass this into setcontext in place of a real 
> context.  I'm -0 on changing this.

Agreed, it's not really important.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6795>
_______________________________________


More information about the Python-bugs-list mailing list