Nick Coghlan <ncogh...@gmail.com> added the comment:

__main__.py files aren't like ordinary modules - they should *not* be defining 
classes or anything like that. Instead, they should be treated as if the entire 
file was implicitly inside an "if __name__ == '__main__':" clause - when 
"imported" they don't do anything.

That's why Antoine's patch set off alarm bells in my head - no normal 
__main__.py will include an explicit "if __name__ == '__main__':" check, so 
multiprocessing should just skip the file completely instead.

There's no doubt that either approach is a hack that will sometimes fail to 
work, but I think skipping the file execution completely will be the right 
decision most of the time (and we can easily say "don't do that then" if people 
rely on class definitions in __main__.py files).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10845>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to