Martin Panter added the comment:

It's not clear what you expected the behaviour to be. A function cannot both 
raise an exception and return a value.

In any case, you are correct in saying "the next option, '-d', is taken as the 
argument." I do not think this is a bug. See 
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html> for the 
Posix specification of "getopt".

Perhaps you are confused by a bug or quirk of "argparse", where it treats most 
CLI arguments that begin with a dash specially, even if according to Posix they 
would be associated with an option. See Issue 9334.

----------
components: +Library (Lib) -Extension Modules
nosy: +martin.panter
resolution:  -> not a bug

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29681>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to