PyWart: "Python's import statement and the history of external dependencies"
rosuav at gmail.com
Fri Nov 21 01:31:33 CET 2014
On Fri, Nov 21, 2014 at 11:14 AM, alex23 <wuwei23 at gmail.com> wrote:
>> 1. Name clashes!
>> 2. Smaller name pool!
> Just off the top of my head, we have several solutions for this:
> 1) Rebinding imports
> import foo as foo2
To be fair to Rick, this doesn't actually solve anything. If you have
two modules called "foo", you can't import one of them this way.
But part of the problem is actually before you even get as far as
importing: it's the nature of open source, forking, and the internet.
There's a module called "remix", which one Peter Sobot forked and
tweaked for his own use, and then distributed a slightly changed
version of. (I believe the original intention was for the patches to
be incorporated into trunk, but that hasn't happened as yet.) If you
want to use his app, you need to use his tweaked remix module; if you
want to use someone else's, you might need to use the original from
upstream. What do you do about that? They're both called "remix". How
do you import one or the other? How do you install one or the other?
There is fundamentally no solution to this. As soon as there are two
incompatible (even just slightly incompatible) versions of a project
in the wild, people need to cope with it. It's the same with avconv vs
ffmpeg, it's the same with wodim vs cdrecord, it's the same with all
of them - until one of them undergoes a name change, everyone's stuck.
More information about the Python-list