On Wed, Dec 2, 2015 at 8:09 PM, Manolo Martínez
<man...@austrohungaro.com> wrote:
> Peter Otten wrote:
>> As far as I can see in a correctly written script the AttributeError cannot
>> be triggered by the user as argparse handles this case automatically by
>> showing the help.
>
> This... is true. I could have sworn that's not the way argparse behaved
> when I wrote that snippet, but I've been very wrong before about similar
> things. Anyway my main() function looks much better now :)

I would recommend not using argparse directly. Pick up a wrapper like
clize, and then define everything through docstrings.

Clize usage example:
https://github.com/Rosuav/LetMeKnow/blob/master/letmeknow.py

https://pypi.python.org/pypi/clize

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to