[Python-Dev] Another relative imports question (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sat Oct 9 19:39:33 CEST 2010


Am 09.10.2010 01:35, schrieb Greg Ewing:

Georg Brandl wrote:

The explanation is that everything that comes after "import" is thereafter usable as an identifier (or expression, in the case of dotted names) in code. ".mymodule" is not a valid expression, so the question would be how to refer to it. I think a reasonable answer is that you should be able to refer to it simply as 'mymodule'.

I don't think that's reasonable:

import xml.dom

doesn't give you dom, but xml.

So

import .dom

shouldn't give you dom, but . (which is nonsensical, of course).

Regards, Martin



More information about the Python-Dev mailing list