Calling class objects

Jp Calderone exarkun at flashmail.com
Sat Mar 4 23:05:33 CET 2000


Having scrapped my last approach to this problem, I now have something
basically like this:

class Master:
	def __init__(self):
		## some init stuff, like get call the loadClass function
		## a few times - this works, printing the results gives
		## <class base.Player.Player at 80d2800>
		playerInitObj = loadClass('Player')

	def connectionMade(self, sock, addr):
		## Call the constructor with sock and addr
		## This is where it seems to die - CPU usage jumps
		## to 100% and the network code stops accepting connections
		## - presumably because it is blocking on this call
		player = playerInitObj(sock, addr)

	def loadClass(name):
		mod = __import__(name)
		return eval(name + '.' + name)


So why doesn't the connectionMade function do what I think it should?
Thanks in advance for any help...

Jp



More information about the Python-list mailing list