Re: A more useful command-line wsgiref.simple_server?

PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> Sun, 1 Apr 2012 00:03:17 -0400
Newsgroups gmane.comp.python.web
Message-ID <CALeMXf78zvTXS+43+X_WBnH3wt8-RqFdDM-5QsrT-vRU-5b9Tg@mail.gmail.com>
On Fri, Mar 30, 2012 at 11:57 PM, Graham Dumpleton <
[email protected]> wrote:

> On 31 March 2012 14:36, PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> 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
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org