python help?

In trying to find an easy way to generate json for citeproc, I went
back to my bibo object model, where I had the start of a to_json
method.

https://github.com/bdarcus/bibo-py/blob/master/bibo/models.py

It works for the Document class and subclasses, but not on the linked
Agent classes. Any suggestions (github has a cool little feature now
that allows by-line comments)?

https://github.com/bdarcus/bibo-py/commit/22619b85c346259864fdf867e29bb9530d0bb82c

Bruce

I’m no python guru, but if you want to access a method from another
class, it would seem to me that the method would either have to be
"static" or the class in question inherits from the class which has
the function you want to access. So in this case, I’m guessing you
would need something like…

class Agent(rdfSubject, Document):

Ron.

Even if the method names are the same?

Bruce

I’m no python guru, but if you want to access a method from another
class, it would seem to me that the method would either have to be
"static" or the class in question inherits from the class which has
the function you want to access. So in this case, I’m guessing you
would need something like…

class Agent(rdfSubject, Document):

Even if the method names are the same?

Again, I’ve never used Python, but any other object oriented language
that I have used, would require that the two classes were somehow
related, or the method being called was a publicly available static
method, but I really don’t know if Python follows the same rules.

OK. It occurs to me it might be better to add this logic to the
Document to_json method instead.

Bruce