Re: Structured programming with optionParser

2010-08-31 Thread NickC
On Mon, 30 Aug 2010 21:19:08 -0700, Michele Simionato wrote: > Perhaps, I should give an example of using plac. > > For more (including managing options, which I have not shown here) you > should check the full documentation of plac. I have just uploaded > release 0.7.2, which is required for th

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
Perhaps, I should give an example of using plac. For instance, here is how you could implement a SVN-like tool with two commands ``checkout`` and ``commit``. The trick is to write a class with two methods ``checkout`` and ``commit`` and an attribute ``.commands`` listing them, and to call the clas

Re: Structured programming with optionParser

2010-08-30 Thread Michele Simionato
On Aug 31, 3:45 am, NickC wrote: > I'm struggling to see how you could refactor the option parsing function. > After all, it has to process the options, so it has to do all the setup > for those options, and then process them. Perhaps plac could simplify your life, by removing most of the boilerp

Structured programming with optionParser

2010-08-30 Thread NickC
I'm writing a short (200 lines) script that has half-a-dozen parameter options, and using optionParser to process the options. I try to write well-written procedural programmes with functions doing one thing well, and so on. The problem I'm getting is that, inevitably, the function that uses Opt