Subclassing builtins or another alternative

Courageous jkraska at
Wed Dec 12 01:30:04 CET 2001

I have an external C-extension type. Let's call it "Agent".

I would like to allow coders using Agent to use it syntactically
as a normal baseclass. For example,

import agent

class Pilot ( agent.Agent ):
	def f(self):

Misfortunately, either one can't do this or I simply misunderstand
what to hook up in the extension. Neither the setattr() or setattro()
methods appear to get invoked by either the class-level data
assignment of "i=3" or the definition of the f method on the class.

What, by the way, are the difference between setattr() and setattro()?

And can I do what I'm trying to do? If so, how?

If read some of the xxsubclass code and the like, but I'm still not


More information about the Python-list mailing list