[Python-checkins] python/dist/src/Lib decimal.py,1.15,1.16
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Wed Jul 14 17:41:59 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23358
Modified Files:
decimal.py
Log Message:
* Rename "Signals" to "_signals" making it non-public.
* Context.create_decimal can take a zero default just like Decimal().
* Fix typo in comment.
Index: decimal.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/decimal.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** decimal.py 10 Jul 2004 14:14:37 -0000 1.15
--- decimal.py 14 Jul 2004 15:41:56 -0000 1.16
***************
*** 121,125 ****
'ROUND_DOWN', 'ROUND_HALF_UP', 'ROUND_HALF_EVEN', 'ROUND_CEILING',
'ROUND_FLOOR', 'ROUND_UP', 'ROUND_HALF_DOWN',
- 'Signals', # <-- Used for building trap/flag dictionaries
# Functions for manipulating contexts
--- 121,124 ----
***************
*** 369,373 ****
# List of public traps and flags
! Signals = [Clamped, DivisionByZero, Inexact, Overflow, Rounded,
Underflow, InvalidOperation, Subnormal]
--- 368,372 ----
# List of public traps and flags
! _signals = [Clamped, DivisionByZero, Inexact, Overflow, Rounded,
Underflow, InvalidOperation, Subnormal]
***************
*** 2121,2127 ****
_ignored_flags=[]):
if not isinstance(flags, dict):
! flags = dict([(s,s in flags) for s in Signals])
if traps is not None and not isinstance(traps, dict):
! traps = dict([(s,s in traps) for s in Signals])
for name, val in locals().items():
if val is None:
--- 2120,2126 ----
_ignored_flags=[]):
if not isinstance(flags, dict):
! flags = dict([(s,s in flags) for s in _signals])
if traps is not None and not isinstance(traps, dict):
! traps = dict([(s,s in traps) for s in _signals])
for name, val in locals().items():
if val is None:
***************
*** 2176,2180 ****
def _ignore_all_flags(self):
"""Ignore all flags, if they are raised"""
! return self._ignore_flags(*Signals)
def _ignore_flags(self, *flags):
--- 2175,2179 ----
def _ignore_all_flags(self):
"""Ignore all flags, if they are raised"""
! return self._ignore_flags(*_signals)
def _ignore_flags(self, *flags):
***************
*** 2245,2249 ****
return rounding
! def create_decimal(self, num):
"""Creates a new Decimal instance but using self as context."""
d = Decimal(num, context=self)
--- 2244,2248 ----
return rounding
! def create_decimal(self, num='0'):
"""Creates a new Decimal instance but using self as context."""
d = Decimal(num, context=self)
***************
*** 2951,2955 ****
# The default context prototype used by Context()
! # Is mutable, so than new contexts can have different default values
DefaultContext = Context(
--- 2950,2954 ----
# The default context prototype used by Context()
! # Is mutable, so that new contexts can have different default values
DefaultContext = Context(
More information about the Python-checkins
mailing list