title: __name__ vs __package__ in python
body: <p>If my understanding is correct, the difference between the <code>__package__</code> and <code>__name__</code> variable is:</p>
  
  <ul>
  <li>They are both the same for an <code>__init__.py</code> file.</li>
  <li>For any other files, <code>__name__</code> will be the full path, and <code>__package__</code> will be the directory of it.</li>
  </ul>
  
  <p>Is this correct? If so, why is it necessary for python to add an additional variable in the scope for the <code>__package__</code> when someone could just as well get it from <code>__name__</code> ?</p>
  
  <p>Example, for a <code>models.py</code> file:</p>
  
  <ul>
  <li><code>__name__</code> ==> apps.main.models</li>
  <li><code>__module__</code> ==> apps.main</li>
  </ul>