I'm stoked!!  Got the first containsKey Map method running in the new style pyDictinoary.  There is a special way to configure the methods you want exposed to jython.  Basically you have to create an 'exposed' class that extends PyBuiltinFuntionNarrow and set it accordingly. 

I'll have to spend a couple of days to pick up all of the Map implementations on the new style PyDictionary but I think it looks good. 


>>> execfile(r"c:\jython21\jython_latest\tests\imports.py")

Put some stuff into a python dictionary

{987: val2, 234: foobar, 1: val1}

>>> pyd

{987: val2, 234: foobar, 1: val1}

>>> pyd[987]

Traceback (innermost last):

  File "<console>", line 1, in ?

KeyError: 987   <<<<<<<<<<<<<<<<<<<<  This is funky though, does not work with an imported dictionary

>>> pyd[9899]=123434

>>> pyd[9899]

123434

>>> pyd.containsKey()

Traceback (innermost last):

  File "<console>", line 1, in ?

TypeError: containsKey() takes exactly one argument (0 given) <<< way cool, huh?!

>>> pyd.containsKey(9899)  << yes!!

1

>>> pyd.containsValue(9899)  << just checking my sanity... (to be done)

Traceback (innermost last):

  File "<console>", line 1, in ?

AttributeError: 'dict' object has no attribute 'containsValue'

>>> pyd.containsKey(987) <<<<<<<<<<<<<<<<<<<<  This is funky though, does not work with an imported dictionary

0

>>> pyd.containsKey(9) <<<<<<<<<<<<<<<<<<<<  This is funky though, does not work with an imported dictionary

0

>>> pyd

{9899: 123434, 987: val2, 234: foobar, 1: val1}

>>> pyd.containsKey(1)

0

>>> isinstance(pyd,Map) <<<<<<<<<<<<<<<<<<<<  This bothers me because it should tell me TRUE now

0

>>> hm=HashMap(pyd) <<<<<<<<<<<<<<<<<<<<  What we are looking for right

>>> hm

{<javainstance object 1>=<javainstance object 2>, <javainstance object 3>=<javainstance object 4>, 9899=123434

, <javainstance object 5>=<javainstance object 6>}<<<<<< Yuck, what up w/ the repr!

>>> hm.containsKey(9899)

0

>>> hm.containsKey(1)

0

>>> hm.keySet()

[<javainstance object 1>, <javainstance object 3>, 9899, <javainstance object 5>]

>>> iter = hm.keySet().iterator()

>>> iter.hasNext()

1                               <<<<<<<<<<<<<<<<<<<  Our PyDictionary created data in a new HashMap

>>> iter.next()

987                             <<<<<<<<<<<<<<<<<<<  Our PyDictionary created data in a new HashMap

>>> iter.next()

1                               <<<<<<<<<<<<<<<<<<<  Our PyDictionary created data in a new HashMap

>>> iter.next()

9899                            <<<<<<<<<<<<<<<<<<<  Our PyDictionary created data in a new HashMap

>>> iter.next()

234                             <<<<<<<<<<<<<<<<<<<  Our PyDictionary created data in a new HashMap

>>> iter.hasNext()

0

>>> hm

{<javainstance object 1>=<javainstance object 2>, <javainstance object 3>=<javainstance object 4>, 9899=123434

, <javainstance object 5>=<javainstance object 6>}

>>> pyd

{9899: 123434, 987: val2, 234: foobar, 1: val1}

>>> pyd.containsKey(9899)

1

>>> 1==1  <<<<<<<< couldn't believe it

1

>>>

Hope to get a patch in soon for this baby along with the new PyIterator.

Re,

Mike