
Aug. 13, 2019
11 p.m.
Chris Angelico wrote:
That's one of the reasons that a simple solution of "make JSONEncoder respect decimal.Decimal" was rejected - it would require that the json module import decimal, which is extremely costly.
I don't follow that -- importing Decimal is a one-time cost, so it's not going to affect the time to parse large amounts of data. Also it could be done lazily in response to a use_decimal flag, in which case the import will only happen if other parts of the program are already using Decimal, so the import won't cost any more in startup time. -- Greg