The underlying implementation of module dictionaries changed from IDictionary
to IDictionary<object,object>. If you're trying to use the CLS methods, you'd
want ContainsKey. However, this might easily change again as it should be an
internal decision. In fact, it's probably a bug in IronPython that these
methods are exposed on module dictionaries at all.
You should be doing this in the Pythonic way:
'site' in sys.modules
Or if you really want to call a method
sys.modules.has_key('site')
When possible you should stick with standard Python-style code as it will both
be most compatible with other versions of IronPython but also between
IronPython and CPython. To what degree IronPython should force you to do this
is still an open question, and not one I want to get into today...
Thanks - Jim
________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sumit Basu
Sent: Monday, May 23, 2005 3:37 PM
To: [email protected]
Subject: [IronPython] Contains() doesn't work anymore for sys.modules?
IronPython.Objects.Dict dictionaries seem to be changed in a strange way in
0.7.5...
�
In IronPython-0.7.4,
�
>>> sys.modules.Contains("site")
True
�
in IronPython-0.7.5
�
>>>sys.modules.Contains("site")
>>> sys.modules.Contains("site")
IronPython.Objects.PythonValueError: bad args to this method <method# Contains
on IronPython.Objects.Dict>
�� at IronPython.Objects.ReflectedMethodBase.Call(Object[] args)
�� at IronPython.Objects.Ops.Call(Object func, Object arg0)
�� at input_36.Run(Frame frame)
�� at IronPython.Hosting.PythonEngine.DoOneInteractive(Frame topFrame)
�� at IronPython.Hosting.PythonEngine.RunInteractive()
�
Looking at the doc string, it seems to want some sort of key-value pair - but
Contains should just take a key, no?
_______________________________________________
users-ironpython.com mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com