[Python-Dev] Re: 2.1 strangness (original) (raw)
Skip Montanaro skip@pobox.com (Skip Montanaro)
Thu, 31 May 2001 13:02:51 -0500
- Previous message: [Python-Dev] RE: Iteration variables and list comprehensions
- Next message: [Python-Dev] Re: 2.1 strangness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Robin" == Robin Becker <robin@jessikat.fsnet.co.uk> writes:
Robin> from httplib import *
Robin> class Bongo(HTTPConnection):
Robin> pass
...
Robin> NameError: name 'HTTPConnection' is not defined
It was a brain fart on my part when creating httplib.all. HTTPConnection was not included in that list. I will check in a fix. In the 2.1 release all was defined as
__all__ = ["HTTP"]
I have changed that to
__all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection",
"HTTPException", "NotConnected", "UnknownProtocol",
"UnknownTransferEncoding", "IllegalKeywordArgument",
"UnimplementedFileMode", "IncompleteRead",
"ImproperConnectionState", "CannotSendRequest", "CannotSendHeader",
"ResponseNotReady", "BadStatusLine", "error"]
and will check the change into CVS shortly. (Thomas, keep an eye open for this as an addition to 2.1.1.)
The workaround I would choose is to not use from "httplib import *":
import httplib
class Bongo(httplib.HTTPConnection):
pass
Robin> Changing the * to HTTPConnection in ttt.py removes the problem.
Yup, that will also work.
Before anyone asks, "Who died and make Skip King?", the scenario as I recall it was that the semantics of all got settled on during discussions on python-dev (the goal of all being to minimize namespace pollution by "from ... *"), but nobody stepped up immediately to do the gtunt work, so I volunteered. The problem in relying on one person (well, at least this one person) to do this was that I had only the following tools at my disposal to decide what belonged in all:
* what was documented in the lib reference manual (which was at times
incomplete)
* my experience with the various modules (some of which was specialized,
some of which was nonexistent)
* the standard library (which generally doesn't use "from ... *" much)
* input from python-dev (whose members also appear not to use "from
... *" very liberally)
In retrospect, I probably should have polled c.l.py with a summary of what I came up with before the 2.1 ship date. If people would like me to do that now (before 2.2 gets anywhere close to release) to try and fill in as many missing symbols as possible, let me know.
-- Skip Montanaro (skip@pobox.com) (847)971-7098
- Previous message: [Python-Dev] RE: Iteration variables and list comprehensions
- Next message: [Python-Dev] Re: 2.1 strangness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]