urllib hangs

Jay Donnell jaydonnell at yahoo.com
Wed Aug 25 18:56:26 CEST 2004


Your example needed the module name in front of the method calls in
test.py
Here it is in case anyone is interested. I had no idea that this sort
of think could be done.

## foo.py
def A():
     print "original A called"

def B():
     A()   # this could also be in another module
           # the effect would be the same


###### bar.py
# this is an addon that modifies foo
import foo

origA = foo.A
def newA():
     print "new A called"
foo.A = newA


#!/usr/bin/python
###### test.py
import foo
foo.B()
import bar
foo.B()



More information about the Python-list mailing list