The GraphDatabase class in the neo4j Python library is extended behind the scenes the first time it is instantiated, this is what enables the backend to be loaded lazily. This has the side effect that it's not possible to create your own subclasses of it.
I could probably modify it to work with subclasses, but I don't really see a use case for that. Wouldn't it be easier and cleaner for you to implement your added functionality as a wrapping library? Cheers, Tobias On Thu, Apr 1, 2010 at 10:42 AM, Subhajit Ghosh <[email protected]>wrote: > Hi, > > I am trying to create a class in Python which will inherit from > neo4j.GraphDatabase. The reason why i am doing so is i want to do some > validations when adding a node to the graph and also add several utility > methods for graph traversals. However the inheritance class does not seem > to > work. I am not able to call the subclass's methods. > > import neo4j > > class Test(neo4j.GraphDatabase): > dummy = 1 > n = Test("testdb") > > print(n.__class__) # returns <class 'neo4j._core.GraphDatabase'> > > Am i doing something wrong here? > > For now, I am delegating all calls to a embedded GraphDatabase object in my > class. But this makes the code verbose. > Please suggest. > > Thanks, > Subhajit > _______________________________________________ > Neo mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > -- Tobias Ivarsson <[email protected]> Hacker, Neo Technology www.neotechnology.com Cellphone: +46 706 534857 _______________________________________________ Neo mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

