Hi all,

I feel like this question is probably a FAQ, but I haven't been able to turn up any documentation--please point me in the right direction if there's anything relevant.

I've got a class in Java that extends java.util.HashMap:

class Foo extends HashMap { /* stuff */ }

I'm using Jython in an embedded manner to pass instances of Foo to Jython scripts for processing. On the Jython side, I have no trouble indexing into the object, i.e. baz = myFoo['bar'], but a lot of the standard dictionary methods aren't available. I'd like to be able to do this:

for k, v in myFoo.items(): # myFoo is from the Java side
  if (k == 'bar')

Specifically, I'd like to be able to use non-modifying dictionary methods, like items(), iteritems(), iterkeys(), itervalues(). How do I get there from here? I'm fine with an 80/20 solution; PyDictionary looks like what I need, except that I do not want the objects stored in the dict to inherit from PyObject (as a rule, the objects I'm storing do have nice Jython conversions). So, I want the class to look like a PyDictionary to the greatest extent possible, but to have its own implementation (which is complex and can't be swapped out).

As an aside, what's the difference between PyDictionary and PyDictionaryDerived?

Thanks in advance. I've been amazed with how easy it's been to get Jython embedding up and running; it's a huge win for my application.