newbie-question: more then one constructor in a python-class?

jepler at unpythonic.net jepler at unpythonic.net
Sun Jul 7 11:26:12 EDT 2002


One pythonic way to do this is with default parameters:
	class MyClass:
		def __init__(self, param=None, param1=None):
			if param1 is None:
				if param is None:
					# 1arg case
				else:
					# 2arg case
			else:
				# 3arg case

Jeff





More information about the Python-list mailing list