Python (and me) getting confused finding keys

Terry Reedy tjreedy at udel.edu
Tue Dec 22 15:46:12 EST 2009


On 12/22/2009 11:33 AM, John wrote:
> Hi there,
>
> I have a rather lengthy program that troubles me for quite some time. After
> some debugging, I arrived at the following assertion error:
>
> for e in edges.keys():
> 	assert edges.has_key(e)

If you are claiming that the above *did* raise AssertionError, then you 
should show a complete, standalone example, including the code that 
created edges. That includes the class statement since the above would 
not happen with a builtin dict. Unless, of oourse, playing guessing 
games is your intention ;-).

tjr




More information about the Python-list mailing list