A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-October/104615.html below:

[Python-Dev] Another relative imports question

[Python-Dev] Another relative imports question [Python-Dev] Another relative imports questionRon Adam rrr at ronadam.com
Sat Oct 9 23:06:55 CEST 2010
On 10/09/2010 12:39 PM, "Martin v. Löwis" wrote:
> 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).


I don't think it would be  "import .dom", but...

from . import dom

It would be another module in xml doing the importing, so xml will have 
already been imported.

Ron


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4