[Python-Dev] Re: Decimal data type issues

Batista, Facundo FBatista at uniFON.com.ar
Fri Apr 16 09:53:35 EDT 2004

[Casey Duncan]

#- I find boolean arguments a general anti-pattern, especially given we
#- have class methods. Why not use an alternate constructor like::
#-   pi = 
#- Decimal.rounded_to_context("3.1415926535897932384626433832795")

This is a good idea to me.

We all must decide which of the following is better:

  a) Decimal(number)     # no context used
     Decimal(number, context)

  b) Decimal(number)     # no context used
     Decimal.using_context(number, context)

"number" can be string, int, etc., but NOT float. The issue with rounding at
a defined position has nothing to do with context.

.	Facundo

More information about the Python-Dev mailing list