dir() without built-in methods
python
Solution
Do you just want to filter out the "special" methods, or actually know which methods are implemented in the instance itself, not inherited from a base (or both, as these are different questions, really)?
You can filter out the special methods with something reasonably simple like:
def vdir(obj):
return [x for x in dir(obj) if not x.startswith('__')]
>>> vdir(a)
['foo']
Problem
Is there some way to get all of the attributes of an object without the built ins? I'm hoping to achieve this without the types package or without manually checking for double underscores if possible. I've tried dir, but it gives me all the built-in stuff. Ideally i'd like something like ``` class A(): foo = 'bar' >>>> dir(a) ['foo'] ``` instead of ``` >>>> dir(a) ['__doc__', '__module__', 'foo'] ```