title: Using dir() at the top level within a class
body: <p>Can you construct a Python function g such that when it is imported,</p>
  
  <p>dir() == g()</p>
  
  <p>returns True. This is really a question about the difference between importing 
  and manually entering a function at the top level.  Many languages make some sort of distinction.  As the answer points out, there is a difference.  What is this difference and why?</p>
  
  <p>Another answer is simply to paste the function g into the top level, leaving out the question of a startup file, which, of course also works.</p>
  
  <p>This is my attempt to get back into the good graces of the "powers that be" who are threatening to banish me from question asking.  I have been thrown out of other places as well that did not want to support the First Amendment, but, of course there is an easy way back in.  The same comment appears below because I'm slow at finding the correct procedure.</p>