[New-bugs-announce] [issue31466] No easy way to change float formatting when subclassing encoder.JSONEncoder

Quentin Peter report at bugs.python.org
Thu Sep 14 05:48:13 EDT 2017


New submission from Quentin Peter:

I want to output floats in ENG format. Working with distance in micrometers, it is a bit annoying to see:
2.5e-5
.0003
instead of 
25e-6
300e-6
The solution I found was to redefine `iterencode` but that doesn't feel right.

I would like to see something similar to the "default" function that is easely modified.

----------
messages: 302162
nosy: qpeter
priority: normal
severity: normal
status: open
title: No easy way to change float formatting when subclassing encoder.JSONEncoder
type: enhancement
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31466>
_______________________________________


More information about the New-bugs-announce mailing list