Background: I'm using this guide; Pony Orm. It tells me to create an object (db = Database()), then create a class that inherits from db (class Person(db.Entity)....). As far as I can tell, Person is inheriting from an instance - I didn't even know that was possible. If it is possible, I don't know how to put the Person class in another file, since all entities would need the same db object, but I don't instantiate the db object until runtime (yet I'm creating them at design time). I feel like I'm missing something fundamental here.
db = Database()
class Person(db.Entity):
name = Required(str)
age = Required(int)
cars = Set('Car')
Questions: (1st) In the example given, is Person really inheriting from an instance(db) or is something else going on? (2nd) How would I put the Person (and other classes) in its own file and share the db instance?
Note: I'm running Python 3.4.
[EDITs]
print(type(db.Entity)) # yields: <class 'pony.orm.core.EntityMeta'>