[Python-checkins] python/dist/src/Lib decimal.py,NONE,1.1

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Jul 1 07:01:33 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26988/Lib
Added Files:
	decimal.py 
Log Message:
Move Decimal from the sandbox into production.
--- NEW FILE: decimal.py ---
# Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
# Todo:
# Add deepcopy and pickle support for contexts
# Consider having a SimpleDecimal subclass implementing X3.274 semantics
# Improve the Context API
# Especially with respect to setting flags and traps
# Consider adding a clear_flags() method to Context
# Provide a clean way of attaching monetary format representations
# Review all exposed constants for utility vs. namespace clutter
[...3046 lines suppressed...]
 mantissa = intpart + fracpart
 tmp = map(int, mantissa)
 backup = tmp
 while tmp and tmp[0] == 0:
 del tmp[0]
 # It's a zero
 if not tmp:
 if backup:
 return (sign, tuple(backup), exp)
 return (sign, (0,), exp)
 mantissa = tuple(tmp)
 return (sign, mantissa, exp)
if __name__ == '__main__':
 import doctest, sys
 doctest.testmod(sys.modules[__name__])


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /