On 31/07/2010 16:30, Nick Coghlan wrote:
On Sun, Aug 1, 2010 at 1:14 AM, Michael Foord<fuzzy...@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.
Have you looked at the code in that example? I don't think it would work...

Michael

Cheers,
Nick.



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to