On Fri, Feb 19, 2010 at 3:52 PM, jpc wrote:
> Should one do the "type cast" below for every int or float when using
> sage ?
>
> sage: type(float(x))
>
> sage: json.dumps( {"a": float(x)} )
> '{"a": 1.8}'
>
> Any easier way ?
You write a custom encoder to do this:
http://docs.python.org/librar
Python json library is of simple use but there's this problem:
sage: import json
sage: json.dumps( {"a": 1.8} )
...produce an error because:
sage: x = 1.8
sage: type(x)
Should one do the "type cast" below for every int or float when using
sage ?
sage: type(float(x))
sage: json.dumps( {"a": flo