handling different arguments depending on first argument

Paul Miller paul at fxtech.com
Sat Apr 27 15:09:45 EDT 2002


I've written a C function (callable from Python) that can take a
variable number of arguments, and the arguments after the first are
dependent on what the first was. For example, the signatures for 2
"modes" might look like this:

	my_func(MODE1, var1, var2, var3=None)
	my_func(MODE2, var1, var2=None)

	etc.

Is it possible to handle this kind of different calling convention in
pure Python? I'd like to write the equivalent of an "overloaded" Python
object constructor, which takes various arguments depending on the
first.



More information about the Python-list mailing list