[IronPython] Dict convertion question

Bruce Christensen t-bruch at microsoft.com
Thu Jul 20 21:06:30 CEST 2006


Sometimes. :) ToCodeString() from .NET is the same as repr() from
Python. So if you stick to simple things like lists, dicts, strings,
etc., then that will work. Once you add objects into the mix, though,
all bets are off.

--Bruce

-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of J. Merrill
Sent: Thursday, July 20, 2006 12:04 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Dict convertion question

At 01:05 AM 7/20/2006, JoeSox wrote (in part)
>File.WriteAllText(Application.StartupPath + "\\mydict.txt",
myDict.ToCodeString());
>(This results in a file size of 1,540,096 bytes which was created in
about a second.)

I don't know much about ToCodeString, but from the name, it should
produce a string that can be treated as Python code.  If you were to
write something like
    mydict =
into the file, name the file mydict.py, and run that file -- wouldn't
you end up with your dictionary back in a Python variable?



J. Merrill / Analytical Software Corp


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



More information about the Ironpython-users mailing list