[Import-sig] Re: Proposal for a modified import mechanism.

Gordon McMillan gmcm@hypernet.com
Sun, 11 Nov 2001 10:52:20 -0500

Prabhu wrote:

> Also, right now, what prevents someone from sticking an os.py
> somewhere in sys.path and completely ruining standard behaviour. 

If they stick it after the real one, it has no effect. If the user 
sticks it in front, it's an installation issue, and the user's 
responsibility. If an author sticks it in front, it's a dirty trick that 
may or may not work.

> So, its not asif this new approach to importing package makes
> things dirty, you can very well do 'bad' things right now.

Of course. The problem here is that it's all implicit and there's 
no way around it.

 sys.modules['os'] = mydirtyhack
is pretty obvious. Putting an os.py (or os/__init__.py) inside a 
package is not. And once it's done, there's no workaround.

- Gordon