<div dir="ltr">FILE = os.path.abspath(__file__)<div>DIR = os.path.abspath(os.path.dirname(__file__))</div><div>?</div><div><br></div><div>Repeated pattern for referencing resources relative to your scripts. Ideas about alternative names / locations are welcome.</div>

<div><br></div><div>In PHP these are __FILE__ and __DIR__. For Python 3 adding __dir__ is impossible, because the name clashes with __dir__ method (which is not implemented for module object, but should be [ ] for consistency). Also current __file__ is rarely absolute path, because it is never normalized [ ].</div>

<div><br></div><div>So it will be nice to see normalization of Python file name after the import to reduce mess and make its behaviour predictable - <a href="http://stackoverflow.com/questions/7116889/python-file-attribute-absolute-or-relative">http://stackoverflow.com/questions/7116889/python-file-attribute-absolute-or-relative</a></div>

<div><br></div><div><br></div><div>----[ possible spec. draft for a beautiful internal structure ]--</div><div>The Python interpreter should provide run-time information about:</div><div>1. order of import sequence</div>
<div>
2. names of imported modules</div><div>3. unique location for each imported module which unambiguously identifies it</div><div>4. run-time import dependency tree (not sure about this, but it can help with debugging)</div>

<div>5. information about sys.path entry where this module was imported from</div><div>6. information about who and when added this sys.path entry</div><div><div>-- <br>anatoly t.</div>
</div></div>