"Alex Martelli" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Very simply, PEP 328 explains:
> """
> Relative Imports and __name__
>
> Relative imports use a module's __name__ attribute to determine that
> module's position in the package hierarchy. If the module's name does
> not contain any package information (e.g. it is set to '__main__') then
> relative imports are resolved as if the module were a top level module,
> regardless of where the module is actually located on the file system.
> """

To change my question somewhat, can you give me an example
where this behavior (when __name__ is '__main__') would
be useful for a script? (I.e., more useful than importing relative
to the directory holding the script, as indicated by __file__.)

Thanks,
Alan Isaac


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to