Patches item #1481112, was opened at 2006-05-03 15:59 Message generated for change (Comment added) made by hwundram You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1481112&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core (C code) Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Heiko Wundram (hwundram) Assigned to: Martin v. Löwis (loewis) Summary: Python long option support Initial Comment: The attached patch implements long option support for Python. It changes the optstring found in Modules/main.c, specifying brackets for the long name of a corresponding option name. The patch is backward compatible in that it doesn't change the behaviour of _PyOS_GetOpt for any old format string, except on [:()], which are explicitly excluded for matching an option. This shouldn't break any code, though. The patch is against Python 2.4.3. ---------------------------------------------------------------------- >Comment By: Heiko Wundram (hwundram) Date: 2006-05-04 08:14 Message: Logged In: YES user_id=791932 I just posted a mail to python-dev explaining my rationale behind this patch. Maybe you could answer there... ---------------------------------------------------------------------- Comment By: Heiko Wundram (hwundram) Date: 2006-05-04 08:06 Message: Logged In: YES user_id=791932 The rationale behind this patch is to enable python to answer to --version and --help, which are pretty much standard command-line options with GNU utilities, and increasingly common amongst BSD utilities. I developed this patch, answering to a request on c.l.p where people were asking for Python to answer to --version, and thought I could generalize it a bit so that long options can also be used for other arguments. ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2006-05-04 06:56 Message: Logged In: YES user_id=21627 I actually wonder what the rationale for this patch is. The command line options of Python seem very clear to me; I don't see the need for long options. This should be discussed on python-dev. ---------------------------------------------------------------------- Comment By: Heiko Wundram (hwundram) Date: 2006-05-03 21:32 Message: Logged In: YES user_id=791932 Final patch which should conform to PEP-7 completely. ---------------------------------------------------------------------- Comment By: Heiko Wundram (hwundram) Date: 2006-05-03 20:59 Message: Logged In: YES user_id=791932 I'll redo the patch with vim now, emacs doesn't like doing 8 spaces indents, at least as far as I can get it configured... Anyway, I assign the copyright to any code contained in this patch to the PSF. ---------------------------------------------------------------------- Comment By: Georg Brandl (gbrandl) Date: 2006-05-03 20:53 Message: Logged In: YES user_id=849994 Please update the patch to follow Python C style guidelines (PEP 7), especially use 8-space tabs to indent. Also, it might be good to send a copyright assignment to the PSF for a patch of this magnitude. Otherwise, I think that this is a desirable feature, at least for --help and --version. ---------------------------------------------------------------------- Comment By: Heiko Wundram (hwundram) Date: 2006-05-03 20:37 Message: Logged In: YES user_id=791932 The attached patch is against the current subversion trunk, and implements long options with possible arguments after an =-sign. It has partial matching for options, erroring out on ambiguous matches of the command line arguments. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1481112&group_id=5470 _______________________________________________ Patches mailing list [email protected] http://mail.python.org/mailman/listinfo/patches
