pombreda / python-graph

Automatically exported from code.google.com/p/python-graph
Other
0 stars 0 forks source link

Common Node throws exception when compared to non-node #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you compare common (core/pygraph/mixins/common.py) to anything that's not a 
node, it will throw an AttributeError.

This is really inconvenient when using libraries (in this case, specifically 
pyyaml) that check equality between things that may not be the same object.

Attached is a fix. It tries to compare the nodes and if it throws an attribute 
error, they must not be the same type and it returns false.

With this fix, you can serialize a graph using pyyaml without any exceptions 
being thrown.

Original issue reported on code.google.com by jonathan...@gmail.com on 10 Mar 2011 at 6:50

Attachments:

GoogleCodeExporter commented 9 years ago
Fair enough.

Original comment by pmatiello on 11 Mar 2011 at 5:42

GoogleCodeExporter commented 9 years ago
Patch applied. Thanks!

Original comment by pmatiello on 14 Mar 2011 at 1:26