On Fri, Feb 19, 2010 at 3:52 PM, jpc <[email protected]> wrote:

> Should one do the "type cast" below for every int or float when using
> sage ?
>
> sage: type(float(x))
> <type 'float'>
> sage: json.dumps( {"a": float(x)} )
> '{"a": 1.8}'
>
> Any easier way ?

You write a custom encoder to do this:

http://docs.python.org/library/json.html#encoders-and-decoders

--Mike

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to