I'm trying to combine 'choices' with a comma-seperated list of options, so I 
could do e.g., 

--cheat=a,b

    parser.add_argument ('--cheat', choices=('a','b','c'), type=lambda x: 
x.split(','), default=[])

test.py --cheat a
 error: argument --cheat: invalid choice: ['a'] (choose from 'a', 'b', 'c')

The validation of choice is failing, because parse returns a list, not an item. 
 
Suggestions?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to