On Fri, Mar 30, 2012 at 11:57 PM, Graham Dumpleton < graham.dumple...@gmail.com> wrote:
> On 31 March 2012 14:36, PJ Eby <p...@telecommunity.com> wrote: > > Why give them a __name__ at all? Aren't they scripts, rather than > modules? > > ISTM that not having a __name__ would also let things like pickles fail > > faster. That is, code that expected a module rather than a script would > > break right away. > > Because not having a __name__ attribute at all would make: > > if __name__ == '__main__': > ... > > fail straight away and people quite often had that in scripts so they > could run it directly as well with a pure WSGI server. > Well, they could always replace it with "if globals().get('__name__', '__main__')== '__main__':", I suppose. ;-) >
_______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com