|
From: <Jam...@i2...> - 2001-04-12 17:59:11
|
I don't have easy access to the latest Jython release so I don't know if
this is still a problem (maybe someone could check :-) ) but in the
version I'm using vars() and foo.__dict__ (for a module foo) return an
object which is not a dict and therefore cannot be used in the update
method for dicts. This is kind of a pain when you have a local dict and
need to update the values from a module import. The workaround is to loop
through all the values individually (yuk).
C:\>python
Python 2.0b1 (#4, Sep 7 2000, 02:40:55) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> type(vars())
<type 'dictionary'>
>>> {}.update(vars())
>>>
C:\_Dev\pnp\build>jpython
JPython 1.1+09 with I2 extensions on java1.3.0 (JIT: null)
Copyright (C) 1997-1999 Corporation for National Research Initiatives
>>> type(vars())
<jclass org.python.core.PyStringMap at 2865120>
>>> {}.update(vars())
Traceback (innermost last):
File "<console>", line 1, in ?
TypeError: dictionary expected, got instance of
'org.python.core.PyStringMap'
>>>
Jim
|