|
From: David H. <dav...@gm...> - 2008-05-08 22:05:04
|
I can think of one thing that would be awkward from a backwards compatibility standpoint. Currently, if m is a Map that does not contain "foo" as a key, then in Python code m['foo'] returns None. If m is a dict that does not contain "foo" as a key, then m['foo'] throws a KeyError. So, if m is a Map *and* a dict, what does m['foo'] do? There may be existing code written to handle both Maps and dicts that tests whether m is a Map and then uses m[k] == None to test whether k is in m. It's not the best way to implement this functionality, and it's wrong if k is mapped to null, but I imagine such code exists and works fine in the field. Personally, I say breaking this is worth it, but opinions will differ, I'm sure. -David On Wed, Apr 30, 2008 at 5:26 PM, Tim Gilbert <ti...@sk...> wrote: > On a more general note about this dict versus Map stuff, can anyone > explain why the jython dict class doesn't simply implement > java.lang.Map? It seems like such an obvious thing to do that I'm sure > there must be good reason why it hasn't been done, but I don't know what > that reason is. Off the top of my head I can't think of any > functionality from the java version that the python version lacks, though. > > Thanks > Tim > > > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |