Returning other instance from __init__

Paulo da Silva psdasilvaX at esotericaX.ptX
Thu Mar 15 05:33:01 CET 2007


I would like to implement something like this:

class C1:
	def __init__(self,xxx):
		if ... :
			self.foo = foo
			self.bar = bar
		else:
			self=C1.load(xxx)

	def load(xxx):
		...
		return instance_of_C1
	load=staticmethod(load)

This does not seem correct. How can I do it?

Thanks for any help
Paulo



More information about the Python-list mailing list