[Boost.Graph] graph.vertices property creates new objects

Szabolcs Nagy nszabolcs at gmail.com
Mon Jan 29 18:09:29 EST 2007


> It seems that the vertices iterator creates new vertex objects every
> time instead of iterating over the existing ones. This essentially

i don't know much about bgl, but this is possible since vertices are 
most likely not stored as python objects inside boost

> prevents, among other things, storing vertices as keys in a dictionary
> since the hashes of the stored and the new vertex differ although they
> compare equal. Is this really what's happening, and if so, why ?

that sounds bad, fortunately __hash__ can be overriden so even if id() 
differs hash() can be the same for the same vertex.
if __hash__ is not handled then it's a bug in bgl imho.




More information about the Python-list mailing list