[Python-3000] PEP 3108: Standard Library Reorganization

Giovanni Bajo rasky at develer.com
Wed Jan 3 01:21:37 CET 2007


Jim Jewett wrote:

>> * getopt
>>     + optparse provides better functionality.
> 
> Yes and no.  getopt does provide a (non-python-specific) standard
> parsing, and is still widely used.
> I would say keep it unless the converter could automate the
> translation to *lightweigt* optparse usage.  (Shouldn't add more than
> ~15% to the script's "here is where I deal with options" code.)

I'm not sure what you mean here. In my experience, converting to optparse 
results in *less* code, especially if the script has a relatively complex 
command line interface.

Let alone the fact that it makes possible to adhere to the "say it once" 
principle, while getopt forces to several repetitions (each option is repeated 
in the getopt argument strings, in the if/else chain, and in the usage screen 
at least).

Are you worried more for existing code or for new code? Do you believe getopt 
still makes sense even for new code, and if so, would you please elaborate on 
this?
-- 
Giovanni Bajo



More information about the Python-3000 mailing list