On 5 Aug 2005 08:34:32 -0700
[EMAIL PROTECTED] wrote:
> Is there a better way of doing this so that I don't have to go through
> every permutation of possible arguments (the example here from the
> matplotlib 'plot' function):
>
> def makeplot(self, xvalues, yvalues, linecolor='', linewidth=''):
> if linecolor and linewidth:
> plot(xvalues, yvalues, linecolor, linewidth=linewidth)
> elif linecolor:
> plot(xvalues, yvalues, linecolor)
> elif linewidth:
> plot(xvalues, yvalues, linewidth=linewidth)
> else:
> plot(xvalues, yvalues)
What's wrong with:
def makeplot(self, xvalues, yvalues, **kwargs):
plot(xvalues, yvalues, **kwargs)
or even:
def makeplot(self, *a, **ka):
plot(*a, **ka)
?
--
jk
--
http://mail.python.org/mailman/listinfo/python-list