Issue473512
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2001-10-21 21:34 by astrand, last changed 2022-04-10 16:04 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
getopt.patch | astrand, 2002-05-12 21:43 | More documentation. Allow empty option string. |
Messages (11) | |||
---|---|---|---|
msg37910 - (view) | Author: Peter Åstrand (astrand) * | Date: 2001-10-21 21:34 | |
Implements GNU style scanning mode. The traditional mode is used if the option string begins with + or if the environment variable POSIXLY_CORRECT is set, just like GNU getopt. Patch includes updated documentation and test. |
|||
msg37911 - (view) | Author: Guido van Rossum (gvanrossum) * | Date: 2001-10-22 00:37 | |
Logged In: YES user_id=6380 Rejected in this form. We can't suddenly change the default behavior. If you want a way to support GNU style options (which I personally hate, but which I would accept as an option), try adding a different function (e.g. gnu_getopt(...)) or add a flag argument (e.g. getopt(..., gnu=1)). |
|||
msg37912 - (view) | Author: Peter Åstrand (astrand) * | Date: 2001-11-11 16:09 | |
Logged In: YES user_id=344921 The new patch uses a new function, gnu_getopt, instead of changing the default behaviour. |
|||
msg37913 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2001-11-24 10:10 | |
Logged In: YES user_id=21627 The patch looks good to me. Since it introduces a new feature, it will be postponed after 2.2 (negotiate with the 2.2 release manager if you want to see it included). Notice that it doesn't offer all features of GNU getopt. It doesn't support the getopt_long_only mechanism (where all options are long, even if they have a single - only). Further, it doesn't allow the caller to specify ordering, and it doesn't support the RETURN_IN_ORDER option (which would be difficult to support with the current calling convention, though). I'm not asking that these problems are somehow resolved; they are meant as proposals for improvements only. |
|||
msg37914 - (view) | Author: Fred Drake (fdrake) | Date: 2001-12-06 14:50 | |
Logged In: YES user_id=3066 The documentation needs to clearly describe the differences between GNU-style scanning and what's done in getopt.getopt() -- it seems to assume the reader knows the differences. The implementation of gnu_getopt() also assumes that args will be non-empty. If the caller wants only long options and passes '' as args, IndexError will be raised. Check for a leading '+' with args.startswith('+') to be safe. |
|||
msg37915 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2002-05-06 08:51 | |
Logged In: YES user_id=21627 If there is no update of this patch by June 1, it will be rejected. |
|||
msg37916 - (view) | Author: Peter Åstrand (astrand) * | Date: 2002-05-12 21:44 | |
Logged In: YES user_id=344921 New patch added, which hopefully fixes the identified problems. |
|||
msg37917 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2002-06-04 19:47 | |
Logged In: YES user_id=21627 Any comments on http://mail.python.org/pipermail/python-dev/2002-June/025002.html ? |
|||
msg37918 - (view) | Author: Peter Åstrand (astrand) * | Date: 2002-06-04 20:35 | |
Logged In: YES user_id=344921 The intent is to provide a function that works like GNU getopt. However, I don't think it's necessary that getopt.gnu_getopt works exactly as GNU getopt. If later GNU version introduces new features etc some time in the future, we can discuss if we want to add them or not when that happens. So, the name gnu_getopt is good enough I think. I won't object to an capitalized version either, but the current name is my preferred choice. |
|||
msg37919 - (view) | Author: Neal Norwitz (nnorwitz) * | Date: 2002-06-13 23:02 | |
Logged In: YES user_id=33168 Martin, didn't you check this in Lib/getopt.py 1.18? Should this be closed? |
|||
msg37920 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2002-06-14 08:35 | |
Logged In: YES user_id=21627 Yes, I did, and I was pretty sure I closed this bug. Trying again. Thanks again for the patch. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:04:33 | admin | set | github: 35375 |
2001-10-21 21:34:41 | astrand | create |