[Web-SIG] WSGI in standard library

Guido van Rossum guido at python.org
Wed Feb 15 01:07:58 CET 2006


On 2/14/06, Alan Kennedy <pywebsig at xhaus.com> wrote:
> [Alan Kennedy]
> Two things made me think like that
>
> 1. BaseHttpServer -> BaseHttpServer.py
>     SimpleHttpServer -> SimpleHttpServer.py
>     WSGIHttpServer -> WSGIHttpServer.py

Actually BaseHTTPServer.py and friends use a deprecated naming scheme
-- just as StringIO, UserDict and many other fine standard library
modules.

If you read PEP 8, the current best practice is for module names to be
all-lowercase and *different* from the class name.

The main reason for this is the following common mistake:

import StringIO
.
. (100s of lines of code)
.
...f = StringIO()           # oops, should've been StringIO.StringIO().

vs.

from String import StringIO
.
. (100s of lines of code)
.
...f = StringIO.StringIO()           # oops, should've been StringIO().

Since both import styles are common, it's easy to forget which import
style was used and to use the wrong invocation style. While the error
doesn't pass silently, it's annoying and a bit jarring; the error
message isn't all that clear.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Web-SIG mailing list