Re: [Tutor] Groups of mutually exclusive options

2014-04-24 Thread Steven D'Aprano
On Tue, Apr 22, 2014 at 10:47:09AM -0700, Alex Kleider wrote: > On 2014-04-21 19:35, Steven D'Aprano wrote: > > >Does docopt solve the Original Poster's question? If not, that advice > >is not terribly helpful. > > I don't pretend to fully understand the Original Poster's requirement > but I be

Re: [Tutor] Groups of mutually exclusive options

2014-04-22 Thread Alex Kleider
On 2014-04-21 19:35, Steven D'Aprano wrote: Does docopt solve the Original Poster's question? If not, that advice is not terribly helpful. I don't pretend to fully understand the Original Poster's requirement but I believe mutual exclusivity is supported. Here's a short excerpt. """ Example

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread Steven D'Aprano
On Mon, Apr 21, 2014 at 08:26:41PM -0400, rail shafigulin wrote: > For example say I have a the script with called myscript.py which can take > two groups of options > > group1 > option1a > option1b > option1c > group2 > option2a > option2b > otpion2c > > I can run this s

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread Steven D'Aprano
On Mon, Apr 21, 2014 at 05:05:49PM -0400, rail shafigulin wrote: > Does anybody know if there is a way to specify groups of mutually exclusive > options using argparse module? I'm not an expert on argparse, but I think not. If I've understand correctly, this seems to suggest that argparse does no

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread Steven D'Aprano
On Mon, Apr 21, 2014 at 05:37:28PM -0700, Alex Kleider wrote: > On 2014-04-21 14:05, rail shafigulin wrote: > >Does anybody know if there is a way to specify groups of mutually > >exclusive > >options using argparse module? > > > > As someone pointed out on this list some months ago, you might wa

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread Alex Kleider
On 2014-04-21 14:05, rail shafigulin wrote: Does anybody know if there is a way to specify groups of mutually exclusive options using argparse module? As someone pointed out on this list some months ago, you might want to consider using docopt instead of argparse. It is much more in keeping

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread rail shafigulin
> > >> > Sorry, I didn't follow your example. Can you explain what you mean in > English? What would be the outcome if you succeeded? > What could the user do and not do? The idea is to use two groups of parameters. The user can use only one group of parameters. For example say I have a the scri

Re: [Tutor] Groups of mutually exclusive options

2014-04-21 Thread Alan Gauld
On 21/04/14 22:05, rail shafigulin wrote: Does anybody know if there is a way to specify groups of mutually exclusive options using argparse module? Sorry, I didn't follow your example. Can you explain what you mean in English? What would be the outcome if you succeeded? What could the user

[Tutor] Groups of mutually exclusive options

2014-04-21 Thread rail shafigulin
Does anybody know if there is a way to specify groups of mutually exclusive options using argparse module? Currently argpase allows to specify mutually exclusive options in the following way (taken from https://docs.python.org/release/3.4.0/library/argparse.html#argparse.ArgumentParser.add_mutuall