Reputation: 1198
It looks like the ndb.polymodel.PolyModel
class used to have a class_name()
method but as far as I can tell it has been deprecated.
I have a data structure using polymodel that is in the form of a parent User class with two child classes - Employee and Manager, and I want to do some basic checks throughout to determine if the User object is of the class Employee or class Manager.
At the moment, I am just calling the object's .__class__.__name__
attribute directly, but I am wondering why the PolyModel.class_name()
method was deprecated. Is there a better way to determine class inheritance?
Upvotes: 1
Views: 50
Reputation: 2536
Per comments above it looks like what you need is isinstance(user, Employee)
/ isinstance(user, Manager)
.
Upvotes: 2