On Sat, 20 Apr 2013, Chris “Kwpolska” Warrick wrote:
On Fri, Apr 19, 2013 at 9:42 PM, Grant Edwards invalid@invalid.invalid wrote:
The OP asked for a string, and I thought you were proposing the string
'null'. If one is to use a string, then 'NaN' makes the most sense,
since it can be
On Fri, Apr 19, 2013 at 9:42 PM, Grant Edwards invalid@invalid.invalid wrote:
The OP asked for a string, and I thought you were proposing the string
'null'. If one is to use a string, then 'NaN' makes the most sense,
since it can be converted back into a floating point NaN object.
I infer
On 2013-04-19 10:34, Tim Roberts wrote:
Miki Tebeka miki.teb...@gmail.com wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string* 'N/A'
On 2013-04-18, Wayne Werner wa...@waynewerner.com wrote:
On Wed, 17 Apr 2013, Miki Tebeka wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the
On Fri, Apr 19, 2013 at 4:54 PM, Grant Edwards invalid@invalid.invalid wrote:
On 2013-04-18, Wayne Werner wa...@waynewerner.com wrote:
On Wed, 17 Apr 2013, Miki Tebeka wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's
On 2013-04-19, Chris ???Kwpolska??? Warrick kwpol...@gmail.com wrote:
On Fri, Apr 19, 2013 at 4:54 PM, Grant Edwards invalid@invalid.invalid
wrote:
On 2013-04-18, Wayne Werner wa...@waynewerner.com wrote:
On Wed, 17 Apr 2013, Miki Tebeka wrote:
I'm trying to find a way to have json emit
You understand that this will result in a chunk of text that is not JSON?
I think he means something like this:
json.dumps([float('nan')])
'[N/A]'
That's exactly what I mean :)
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 18, 2013 at 11:46:37AM +1000, Chris Angelico wrote:
Wait... you can do that? It's internal to iterencode, at least in
Python 3.3 and 2.7 that I'm looking at here.
In Python 2.6 it wasn't internal to iterencode; in Python 2.7 and 3.x
you probably would have to monkey-patch iterencode.
On Wed, 17 Apr 2013, Miki Tebeka wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string* 'N/A' for every NaN.
Why not use `null` instead?
Miki Tebeka miki.teb...@gmail.com wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string* 'N/A' for every NaN.
You understand that this
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string* 'N/A' for every NaN.
--
http://mail.python.org/mailman/listinfo/python-list
In c37a3b9c-6fe8-48aa-b703-9b4f922c3...@googlegroups.com Miki Tebeka
miki.teb...@gmail.com writes:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit
Miki Tebeka miki.teb...@gmail.com writes:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string* 'N/A' for every NaN.
Easiest way is probably to
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
Easiest way is probably to transform your object before you try to write
Yeah, that's what I ended up doing. Wondered if there's a better way ...
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
On 04/17/2013 03:05 PM, Johann Hibschman wrote:
Miki Tebeka miki.teb...@gmail.com writes:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
No. There is no way to represent NaN in JSON. It's simply not part of the
specification.
I know that. I'm trying to emit the *string*
Hi,
Easiest way is probably to transform your object before you try to write
Yeah, that's what I ended up doing. Wondered if there's a better way ...
yes, there is: subclass+extend the JSON-encoder, see pydoc json.
e.g.:
class JsonNanEncoder(json.JSONEncoder):
def default(self, obj):
[Roland]
yes, there is: subclass+extend the JSON-encoder, see pydoc json.
Please read the original post before answering. What you suggested does not
work since NaN is of float type.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
yes, there is: subclass+extend the JSON-encoder, see pydoc json.
Please read the original post before answering. What you suggested does not
work since NaN is of float type.
ok, right, default does not work this way.
But I would still suggest to extend the JSON-encoder, since that is
On Thu, Apr 18, 2013 at 11:01 AM, Miki Tebeka miki.teb...@gmail.com wrote:
[Roland]
yes, there is: subclass+extend the JSON-encoder, see pydoc json.
Please read the original post before answering. What you suggested does not
work since NaN is of float type.
You may be able to override a bit
On Thu, Apr 18, 2013 at 11:39 AM, Roland Koebler r.koeb...@yahoo.de wrote:
as a quickhack, you
could even monkey patch json.encoder.floatstr with a wrapper which
returns N/A for NaN. (I've tested it: It works.)
Wait... you can do that? It's internal to iterencode, at least in
Python 3.3 and
Greetings,
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
I can't seem to find a way since NaN is a float, which means overriding
default won't help.
Any simple way to do this?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
Miki Tebeka miki.teb...@gmail.com wrote:
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
I can't seem to find a way since NaN is a float, which means overriding
default won't help.
Any simple way to do this?
No. There is no way to represent NaN in JSON. It's simply not part
22 matches
Mail list logo