How to get a list of variables in specific Python module?
Question: Let's assume I have the following file structure:

**data.py**

    
    
    foo = []
    bar = []
    abc = "def"
    

**core.py**

    
    
    import data
    # do something here #
    # a = ...
    print a
    # ['foo', 'bar', 'abc']
    

I need to get all the variables defined in data.py file. How can I achieve
that? I could use `dir()`, but it returns all the attributes of the module
including `__name__` and so on.


Answer: 
    print [item for item in dir(adfix) if not item.startswith("__")]
    

Is usually the recipe for doing this, but it begs the question.

# Why?

