Changes between Version 59 and Version 60 of pyson


Ignore:
Timestamp:
02/09/22 10:37:07 (3 years ago)
Author:
wouter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • pyson

    v59 v60  
    6363The dict and list are treated even more special as we also support the List[TYPE] and Dict[KEYTYPE, VALUETYPE] types.
    6464
    65 WARNING: Using Decimal causes rounding errors. This is because pyson takes python's json representation format which contains floats for numbers. And floats can not represent all decimals accurately.
     65WARNING: Using Decimal causes rounding errors. This is because pyson takes python's json representation format which contains floats for numbers. And floats can not represent all decimals accurately. For example, in python {{{str(0.24745759773026107) == '0.24745759773026108'}}}. Overall, a number string "N" in your json text will converted as {{{Decimal(str(float("N")))}}} . When in doubt, check for your number "N" that str(float(N))==N, if not you have a rounding issue.
    6666
    6767You can use {{{ Union[X, NoneType] }}} where {{{NoneType=type(None)}}} or {{{Optional[X]}}}if the object can also be None. So for exmple you can use {{{reservationBid:Union[Bid,type(None)] = None}}}. Do not use the mypy.NoneType which is an entirely different class. We do not support {{{ Union[X,Y] }}} where both X and Y are not NoneType.