Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-08 Thread Peter Cacioppi
On Saturday, October 5, 2013 9:04:25 PM UTC-7, John Ladasky wrote: > Hi folks, > > > > I'm trying to make some of Python class definitions behave like the ones I > find in professional packages, such as Matplotlib. A Matplotlib class can > often have a very large number of arguments -- some o

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Wow, Steven, that was a great, detailed reply. I hope you will forgive me for shortcutting to the end, because I've been hacking away for a few hours and came to this very conclusion: On Monday, October 7, 2013 2:13:10 PM UTC-7, Steven D'Aprano wrote: > In general, you should aim to use either

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Steven D'Aprano
On Mon, 07 Oct 2013 09:26:51 -0700, John Ladasky wrote: > Thanks, everyone, for your replies. Perhaps I have complicated things > unnecessarily? I was just trying to do some error-checking on the > arguments supplied to the class constructor. Perhaps Python already > implements automatically wh

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Peter Cacioppi
On Saturday, October 5, 2013 9:04:25 PM UTC-7, John Ladasky wrote: > Hi folks, > > > > I'm trying to make some of Python class definitions behave like the ones I > find in professional packages, such as Matplotlib. A Matplotlib class can > often have a very large number of arguments -- some o

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
On Monday, October 7, 2013 9:26:51 AM UTC-7, I wrote: > Here is one more detail which may be relevant. The base class for the family > of classes I am developing is a numpy.ndarray. The numpy.ndarray is a C > extension type (and if I understand correctly, that means it is immutable by > ordina

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread John Ladasky
Thanks, everyone, for your replies. Perhaps I have complicated things unnecessarily? I was just trying to do some error-checking on the arguments supplied to the class constructor. Perhaps Python already implements automatically what I am trying to accomplish manually? I'll tinker around wit

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-07 Thread Skip Montanaro
> What makes Matplotlib so professional? > > Assuming that "professional" packages necessarily do the right thing is > an unsafe assumption. Many packages have *lousy* interfaces. Not that it's a complete explanation for matplotlib's interfaces, but it did start out as a Python-based replacement f

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-06 Thread Steven D'Aprano
On Sat, 05 Oct 2013 21:04:25 -0700, John Ladasky wrote: > Hi folks, > > I'm trying to make some of Python class definitions behave like the ones > I find in professional packages, such as Matplotlib. A Matplotlib class > can often have a very large number of arguments -- some of which may be > o

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-06 Thread Peter Cacioppi
On Saturday, October 5, 2013 9:04:25 PM UTC-7, John Ladasky wrote: > Hi folks, > > > > I'm trying to make some of Python class definitions behave like the ones I > find in professional packages, such as Matplotlib. A Matplotlib class can > often have a very large number of arguments -- some o

Re: Variable arguments (*args, **kwargs): seeking elegance

2013-10-06 Thread Peter Otten
John Ladasky wrote: > Hi folks, > > I'm trying to make some of Python class definitions behave like the ones I > find in professional packages, such as Matplotlib. A Matplotlib class can > often have a very large number of arguments -- some of which may be > optional, some of which will assume d

Variable arguments (*args, **kwargs): seeking elegance

2013-10-05 Thread John Ladasky
Hi folks, I'm trying to make some of Python class definitions behave like the ones I find in professional packages, such as Matplotlib. A Matplotlib class can often have a very large number of arguments -- some of which may be optional, some of which will assume default values if the user does