Loading multiple versions of the same package at the same time

Diez B. Roggisch deets at nospam.web.de
Thu Nov 27 12:09:58 CET 2008


della wrote:

> On 27 Nov, 11:21, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 
>> You can't do that. How should python distinguish between the two modules
>> with the same name?
> 
> That's why I was trying to import them with different names :)

You weren't. The "as" creates just a local alias. It's roughly equivalent to


import foo as bar

<->

import foo
bar = foo
del foo


But in the interpreters module dict, foo it is, and stays.

Diez



More information about the Python-list mailing list