[Web-SIG] A more useful command-line wsgiref.simple_server?
PJ Eby
pje at telecommunity.com
Sun Apr 1 06:03:17 CEST 2012
On Fri, Mar 30, 2012 at 11:57 PM, Graham Dumpleton <
graham.dumpleton at gmail.com> wrote:
> On 31 March 2012 14:36, PJ Eby <pje at 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. ;-)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20120401/8a771a36/attachment.html>
More information about the Web-SIG
mailing list