Live data from Hacker News

How to Get a List of Class Attributes in Python

blog.pythonlibrary.org

1–2 of 2 posts

Re: How to Get a List of Class Attributes in Python

#2
>Thus we loop over each item in the class dict and only append them to the list if they are not callable (i.e. not methods). Pretty slick and it doesn’t require any imports! But there’s an even easier way!

Actually, objects can be callable by implementing the __call__ method. The inspect.ismethod() is the better solution