The “dir()” function in python retrieves all attributes for a class. I was wondering if there was a similar function that returns only user defined functions? Thanks!
The dir() function in python retrieves all attributes for a class. I was wondering
Share
If you want to tell a builtin from a user-defined function I’d use the types module.
For instance:
Then it depends on what you want to do.You could use list comprehensions to check all attributes of a class and keep only those that turn out to be true.
Hope it helps.