Mart Somermaa wrote:
But it is not. The proposed __import__(name, submodule=True) has
a compatible interface. All tests pass with
http://bugs.python.org/file12136/issue4438.diff .

Your approach complicates the interface. Every implementation of Python and every replacement __import__ would have to implement the additional argument, too. There is simply no need to make the interface more complex when an additional, trivial function does the same job.

As for the imp approach, I've alternatively implemented
imp.import_module() that imports tail modules in
http://bugs.python.org/file12147/imp_import_module.diff
(colour diff in http://dpaste.com/hold/94431/).

IMHO the functionality duplication with __import__ is ugly, but
if it is desired that __import__ does not change (even in
backwards-compatible way), so be it.

It's not a duplication of functionality. __import__() implements exactly the functionality that is required by Python's import system. Anything else can be implemented on top of it. We simply prefer divide 'n conquer over mingle 'n mix. :)

Christian
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to