[Sorry, forgot to answer one of the questions in my previous reply.]
Le Mon, 26 Jan 2009 22:38:24 -0000, "Alan Gauld" firstname.lastname@example.org a écrit :
"spir" email@example.com wrote
=== package module lookup ===
This would also encourage the good practice of never writing absolute imports -- which is a plague.
I'm not sure what you mean by absolute imports. If you mean giving the physical path to the file then You cannot really do that in Python. I don't understand the comment?
What I call "absolute import" happens when you give python an absolute path to look for a module (even if its your own). For sure python does not let you write an absolute path in the import instruction itself, but people do that by appending to PYTHONPATH, using 'sys.path'. Some installation instructions even explicitely tell the users to do that. More commonly, application/package authors often rely on absolute pathes for internal imports (meaning that you cannot even chose the dir's name! not to talk about the actual location...) or external ones.
sys.path.append("path/to/dir") import foo
Actually, for external imports, the only solutions I know are either to use environment variables, or to rely on python standard locations for packages (which are relative to python's root path, itself defined as an environment variable). For intra-package imports, there are now facilities to write relative imports directly: http://www.python.org/dev/peps/pep-0328/#rationale-for-relative-imports
Denis ------ la vida e estranya