Tyler wrote:
> Less than awesome. but a fair point. Do issues like this get logged back to
> bugs.python.org? (IMHO that's a bug with Python, no reason to use
> sre)

It depends upon the issue.  In this case I haven't logged something yet as
I just realized this last week and haven't investigated it very thoroughly.
I've gone ahead and opened a bug (http://bugs.python.org/issue7130).  It
looks like Jython actually implements _sre so we'll see how this goes.

> 
> That said, is there a fairly straightforward means of bridging collections
> like Dictionary<T,T> and List<T> to their python equivalent types? If so, than
> wrapping System.Web.Script.Serialization.JavaScriptSerializer would be a
> decent enough workaround for now IMHO.

Ok, after getting a fix for the relative imports it appears I have spoken too
soon.   Encoding to json works just fine w/ the json module, only decoding 
doesn't work.  I guess that makes sense - you wouldn't use regexes for 
encoding :)

So if you just need to encode you're good to go.

As far as a bridge we do already bridge our dictionaries and lists w/ normal
.NET dictionaries and lists in a variety of ways.  For starters they are 
IDictionary/IDictionary<object, object> and IList/IList<object, object>.  
Also if we're calling a method which takes an IDictionary<K,V> or an 
IList<T> we'll create a wrapper which converts the objects on the fly.
Apparently neither of those help with the JavaScript serializer though!

It does look like you can do:

dict(a.Deserialize[Dictionary[object, object]](a.Serialize(Dictionary[object, 
object]({"foo":42}))))

so you just need to convert the python objects to their .NET equivalents
on the way in and out which isn't too bad.

I don't think there's much else we can do directly other than asking the 
team that owns that to support IDictionary and IList in addition to 
the concrete types.

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to