On 31 March 2012 14:36, PJ Eby <p...@telecommunity.com> wrote: > On Fri, Mar 30, 2012 at 5:12 PM, Graham Dumpleton > <graham.dumple...@gmail.com> wrote: >> >> Now when doing mod_wsgi, a similar method of loading each file >> >> separately with a __name__ based on file system path was used to >> ensure each was distinct when same file name used in different >> directories. > > > 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. >> FWIW, in the past when pushing the idea of a WSGI script file being >> the lowest common denominator, part of the reason I found I couldn't >> get it accepted is that some people simply didn't understand how in >> Python to load an arbitrary file by path name and construct a module >> for it in memory, with magic __name__. They seemed to think that the >> only way to import a code file was for it to have a .py extension and >> for the directory to be in sys.path. So, due to ignorance of the >> solution as to how to do it meant I got a push back from some people. > > Who were you trying to get acceptance from? Web-SIG or Python-Dev? > Framework devs or end-users? Is there a PEP? I brought it up on the WEB-SIG. It may have been bad timing amongst all the other discussions that went around in circles at the time on the WEB-SIG. Also mentioned it in passing to some WSGI server developers and other people when discussing web stuff at meet ups or otherwise. Graham _______________________________________________ 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