type object of an instance without instantiation?

claudius at catlover.com claudius at catlover.com
Sat Nov 6 18:08:23 CET 1999


I have the following code (well, in summary):

class BigClass:
	def __init__(self):
		...does some horrifyingly nasty operation...

def some_generic_fn(object):
	if hasattr(object, '__class__') and object.__class__ == BigClass:
		...do some BigClass-specific thing...

Is there a way to create a type object for the instance of a BigClass object
without actually creating an instance of one?




More information about the Python-list mailing list