[IronPython] KeyError Oddness

Michael Foord michael.foord at resolversystems.com
Fri Oct 6 13:25:42 CEST 2006


Hello IronPython People,

There is a slightly strange difference between a KeyError on CPython and 
a KeyError on IronPython. It certainly isn't blocking us, but will 
result in unnecessarily odd messages being reported to our users.

CPython
 >>> x={}
 >>> try:
...  x['boo']
... except KeyError, e:
...  pass
...
 >>> e.args
('boo',)
 >>> print e.args[0]
boo

IronPython
 >>> try:
...  x ={}
...  x['fish']
... except KeyError, e:
...  pass
...
 >>> e.args
("'fish'",)
 >>> e.args[0]
"'fish'"
 >>> print e.args[0]
'fish'


Michael Foord and Jonathan Hartley
http://www.resolversystems.com
http://www.voidspace.org.uk



More information about the Ironpython-users mailing list