A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-July/045881.html below:

[Python-Dev] decimal API

[Python-Dev] decimal APIBatista, Facundo FBatista at uniFON.com.ar
Mon Jul 5 19:48:21 CEST 2004
[Tim Peters]

#- Note that I've suggested that some trap-enable flags should be set by
#- default for Python:  those for invalid operation, divide by 0, and
#- overflow.  So, in my mind (unsullied by reality <wink>):  (a)
#- conversion of a nonsense string already signals invalid-operation;
#- and, (b) because the invalid-operation trap-enable flag is set by
#- default in Python, it also already raises an exception.

We don't have nothing enabled by default:

>>> import Decimal
>>> for (exc, val) in Decimal.getcontext().trap_enablers.items():
	print str(exc).ljust(50), val

Decimal.Underflow                                  0
Decimal.DivisionByZero                             0
Decimal.DecimalException                           0
Decimal.Clamped                                    0
Decimal.DivisionUndefined                          0
Decimal.Inexact                                    0
Decimal.InvalidContext                             0
Decimal.Overflow                                   0
Decimal.LostDigits                                 0
Decimal.Rounded                                    0
Decimal.Subnormal                                  0
Decimal.InvalidOperation                           0
Decimal.ConversionSyntax                           0
Decimal.DivisionImpossible                         0
>>> 

I'm +1 to enable some by default: DivisionByZero, DivisionUndefined,
Overflow, InvalidOperation, ConversionSyntax and DivisionImpossible are my
proposal, but it's my taste and know nothing about numbers usability...

.	Facundo

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.713 / Virus Database: 469 - Release Date: 30/06/2004
 

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4