En Thu, 20 Nov 2008 17:36:11 -0200, Stef Mientki <[EMAIL PROTECTED]>
escribió:
I'm not an expert, I even don't fully understand your problem,
but having struggled with imports in the past,
I've a solution now, which seems to work quit well.
That's not very helpful, is it? Were you planning to keep the solution
secret?
sorry slip of the keyboard ;-)
http://mientki.ruhosting.nl/data_www/pylab_works/pw_importing.html
May I reiterate my criticism to your "solution" posted last week?
I don't think extending sys.path to include every directory under your
project is a good idea. Basically, you're flattening the directory layout,
removing any structure, like it was before Python 1.5 added package
support.
It is like dumping all your modules in a single directory, with no
hierarchy and lots of name conflicts.
Worse: because your proposal makes the same file reachable under many
different names, the *same* source module will generate *different* module
objects stored as *different* entries in sys.modules. Globals don't work
anymore, subclasses aren't subclasses... lots of problems.
Relative imports (PEP328 [1]) were introduced -among other things- as an
attempt to avoid such problems. You're going in the opposite direction.
Please stop doing that - or at least keep us informed of where you work!
[1] http://www.python.org/dev/peps/pep-0328
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list