[IronPython] very strange dictionnary bug
Stanislas Pinte
stan at ertmssolutions.com
Fri Aug 18 16:35:40 CEST 2006
Hello,
We are just seeing a very strange bug in the following code:
myDictionnary = {}
..
for key in myDictionnary.keys():
assert myDictionnary.has_key(key) --> throw AssertionError
this is fixed by the following change:
for key, value in myDictionnary.iteritems():
...
Ever seen this?
Too bad I cannot reproduce this...a very simple test case like the one
below doesn't do the trick...
thanks,
Stan.
[sim-ironpython]> ironpython/ipy.exe
IronPython 1.0.60816 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> a = {"one": 1, "two": 2, "three": 3}
>>> a["one"]
1
>>> a.pop("one")
1
>>> a
{'two': 2, 'three': 3}
>>> a.keys()
['two', 'three']
>>> for k in a.keys():
.. print k
..
two
three
--
-----------------------------------------------------------------
Stanislas Pinte e-mail: stan at ertmssolutions.com
ERTMS Solutions http://www.ertmssolutions.com
Rue de l'Autonomie, 1 Tel: + 322 - 522.06.63
1070 Bruxelles Fax: + 322 - 522.09.30
-----------------------------------------------------------------
Skype (http://www.skype.com) id: stanpinte
-----------------------------------------------------------------
More information about the Ironpython-users
mailing list