Getopt / matching problem

Andy Gimblett gimbo at ftech.net
Tue Mar 19 10:41:14 EST 2002


On Tue, Mar 19, 2002 at 04:57:33PM +0200, mixo wrote:
> 
> From running the command "python  script.py --use=mixo"
> I get the result
> [('--user', 'mixo')]
> 
> Why do I get match? Is there something that I have left out?
> If I pass "--u", "--us" to script I get the same result?

>From the getopt module documentation:

    Long options on the command line can be recognized so long as they
    provide a prefix of the option name that matches exactly one of
    the accepted options.  For example, it long_options is ['foo',
    'frob'], the option --fo will match as --foo, but --f will not
    match uniquely, so GetoptError will be raised.

So it's nothing to worry about, just the documented behaviour, and
really the way we'd want it to work, if you think about.

Cheers,

-Andy

-- 
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.




More information about the Python-list mailing list