2.1 strangness

Robin Becker robin at jessikat.fsnet.co.uk
Thu May 31 12:13:53 EDT 2001


This is a condensation of some weirds I'm seeing with M2Crypto which I
downloaded today; I'm running SF 2.1 for win32

##################################
#file ttt.py
from httplib import *

class Bongo(HTTPConnection):
        pass
##################################

when I attempt to run this

C:\Python\devel\m2crypto-0.06-snap5-win32\demo\ssl>python \tmp\ttt.py
Traceback (most recent call last):
  File "\tmp\ttt.py", line 3, in ?
    class Bongo(HTTPConnection):
NameError: name 'HTTPConnection' is not defined

but certainly httplib has a class HTTPConnection

is this the famous blow up in your face from the future concerning
shadowed globals? It seems rather nasty to me, but then I objected to
the original static scoping stuff. This seems entirely module level so
what gives?

Changing the * to HTTPConnection in ttt.py removes the problem.
Please don't remind me about optimisations; I thought at least that the
compiler saw things in order so that it sees the * globals before the
class statement.

-- 
Robin Becker



More information about the Python-list mailing list