Re: Python (and me) getting confused finding keys

2009-12-23 Thread John
> The lesson of this? Do not make mutable classes hashable. That could be it! I'll try. Thanks a lot! > The obvious follow-up is to ask how to make an immutable class. > > http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.h > tml > -- http://mail.python.org/mailman/lis

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Alf P. Steinbach
* Steven D'Aprano: [snip] The obvious follow-up is to ask how to make an immutable class. http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.html Thanks, I've been wondering about that. By the way, the link at the bottom in the article you linked to, referring to an

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Steven D'Aprano
On Tue, 22 Dec 2009 17:33:04 +0100, 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) > > Oops!? Is there ANY way that s

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Steven D'Aprano
On Tue, 22 Dec 2009 17:47:14 +0100, Christian Heimes wrote: > John schrieb: >> 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) >

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Terry Reedy
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 Assertion

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Lie Ryan
On 12/23/2009 3: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) Oops!? Is there ANY way that something like this can possi

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Gabriel Genellina
En Tue, 22 Dec 2009 13:56:36 -0300, John escribió: another thread can remove the key prior to the has_key call; or perhaps edges isn't a real dictionary? of course. But unless there is a way of using threading without being aware of it, this is not the case. Also, edges is definitely a di

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Tim Golden
John wrote: another thread can remove the key prior to the has_key call; or perhaps edges isn't a real dictionary? of course. But unless there is a way of using threading without being aware of it, this is not the case. Also, edges is definitely a dict (has been declared some lines before,

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Zac Burns
On Tue, Dec 22, 2009 at 8:56 AM, John wrote: > > another thread can remove the key prior to the has_key call; or perhaps > > edges isn't a real dictionary? > > > > of course. But unless there is a way of using threading without being aware > of > it, this is not the case. Also, edges is definite

Re: Python (and me) getting confused finding keys

2009-12-22 Thread John
> another thread can remove the key prior to the has_key call; or perhaps > edges isn't a real dictionary? > of course. But unless there is a way of using threading without being aware of it, this is not the case. Also, edges is definitely a dict (has been declared some lines before, and no ob

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Christian Heimes
John schrieb: > 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) > > Oops!? Is there ANY way that something like this can possibly ha

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Tim Golden
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) Oops!? Is there ANY way that something like this can possibly happen? Three w

Re: Python (and me) getting confused finding keys

2009-12-22 Thread Robin Becker
On 22/12/2009 16:33, 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) Oops!? Is there ANY way that something like this can possibl