Is there any way to unimport a library

Gelonida N gelonida at gmail.com
Sun Nov 20 12:21:00 EST 2011


I forgot to mention, that this is at the moment more a thought
experiment, than a real need.


On 11/20/2011 05:53 PM, Chris Angelico wrote:
> On Mon, Nov 21, 2011 at 3:39 AM, Gelonida N <gelonida at gmail.com> wrote:
>> No mixing would not be possible.
>>
>> So either I need the first two libs or the second two.
>>
> 
> I wonder, can you make the first one import the second one? That
> automatically defines your dependency right there, and may make things
> clearer - you import lib1_version1, and if that fails, you import
> lib1_version2; if either succeeds, you know the matching lib2 is
> available.
> 

At the moment I will do exactly what you suggested. I will make sure,
that always the first import fails.

But I wanted to learn more what is possible and which potential can of
worms I would open if I wanted to unimport a library of which I'm sure
that nobody is currently referencing (or refering? Not sure about my
English here) to.




More information about the Python-list mailing list