[Python-Dev] unexpected import behaviour (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sat Jul 31 17:30:32 CEST 2010


On Sun, Aug 1, 2010 at 1:14 AM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:

Some people workaround the potential for bugs caused by main reimporting itself by doing it deliberately. Glyf even recommends it as good practise. ;-)

http://glyf.livejournal.com/60326.html So - the fix you suggest would break this code. Raising a warning wouldn't... (and would eventually make this workaround unnecessary.)

With my change, that code would work just fine. "from myproject.gizmo import main" and "from main import main" would just return the same object, whereas currently they return something different.

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list