class documentation

Encodes decimal.Decimal instances.

There are several ways in which a decimal value might be encoded.

Special values are encoded as special strings:

  - Positive infinity is encoded as C{"Infinity"}
  - Negative infinity is encoded as C{"-Infinity"}
  - Quiet not-a-number is encoded as either C{"NaN"} or C{"-NaN"}
  - Signalling not-a-number is encoded as either C{"sNaN"} or C{"-sNaN"}

Normal values are encoded using the base ten string representation, using engineering notation to indicate magnitude without precision, and "normal" digits to indicate precision. For example:

  - C{"1"} represents the value I{1} with precision to one place.
  - C{"-1"} represents the value I{-1} with precision to one place.
  - C{"1.0"} represents the value I{1} with precision to two places.
  - C{"10"} represents the value I{10} with precision to two places.
  - C{"1E+2"} represents the value I{10} with precision to one place.
  - C{"1E-1"} represents the value I{0.1} with precision to one place.
  - C{"1.5E+2"} represents the value I{15} with precision to two places.

http://speleotrove.com/decimal/ should be considered the authoritative specification for the format.

Method fromString Convert a string to a Python object. Subclasses must implement this.
Method toString Serialize a decimal.Decimal instance to the specified wire format.

Inherited from Argument:

Method __init__ Create an Argument.
Method fromBox Populate an 'out' dictionary with mapping names to Python values decoded from an 'in' AmpBox mapping strings to string values.
Method fromStringProto Convert a string to a Python value.
Method retrieve Retrieve the given key from the given dictionary, removing it if found.
Method toBox Populate an 'out' AmpBox with strings encoded from an 'in' dictionary mapping names to Python values.
Method toStringProto Convert a Python object to a string.
Instance Variable optional Undocumented
def fromString(self, inString): (source)

Convert a string to a Python object. Subclasses must implement this.

Parameters
inString:bytesthe string to convert.
Returns
the decoded value from inString
def toString(self, inObject): (source)

Serialize a decimal.Decimal instance to the specified wire format.