Message291959
| Author |
Marian Horban 2 |
| Recipients |
Marian Horban 2 |
| Date |
2017年04月20日.10:04:05 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1492682646.2.0.186501711671.issue30114@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
It is not possible to override 'true', 'false' values during encoding bool.
For example if I want to dump dict like:
{"key": True}
and result must be not
{"key": true}
but let's say
{"key": "TRUE"}
It is really hard to force json.dumps function to do it.
I understand that improving of json encoder performance causes this inflexible implementation.
Perfect solution for extending/overriding json module would be move nested functions
_iterencode_list
_iterencode_dict
_iterencode
into class JSONEncoder as static methods.
But it could make performance a bit worse.
So if we cannot afford it I would propose to move function _make_iterencode to JSONEncoder as a static method.
This change will not degrade performance.
But it will be possible to override this method in SPECIFIC user's Encoder. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2017年04月20日 10:04:06 | Marian Horban 2 | set | recipients:
+ Marian Horban 2 |
| 2017年04月20日 10:04:06 | Marian Horban 2 | set | messageid: <1492682646.2.0.186501711671.issue30114@psf.upfronthosting.co.za> |
| 2017年04月20日 10:04:06 | Marian Horban 2 | link | issue30114 messages |
| 2017年04月20日 10:04:05 | Marian Horban 2 | create |
|