Reputation: 3496
Lets say I have a class like below.
class Foo(object):
def __init__(self, a, b):
self.a = a
self.b = b
Is there function that will allow me get all the attributes? For example:
attributes(Foo)
# [a, b]
From what I have been able to find, it seems it is only possible with class attributes.
Upvotes: 2
Views: 271
Reputation: 251398
No, because those attributes do not actually exist until an instance is created.
Upvotes: 2