[Python-Dev] Re: Call for reviewer!

Barry A. Warsaw bwarsaw@beopen.com
Wed, 16 Aug 2000 09:21:59 -0400 (EDT)


I used to think getopt needed a lot of changes, but I'm not so sure
anymore.  getopt's current API works fine for me and I use it in all
my scripts.  However,

>>>>> "DG" == David Goodger <dgoodger@bigfoot.com> writes:

    DG> The incompatibility was introduced because the current
    DG> getopt() returns an empty string as the optarg (second element
    DG> of the tuple) for an argumentless option. I changed it to
    DG> return None. Otherwise, it's impossible to differentiate
    DG> between an argumentless option '-a' and an empty string
    DG> argument '-a ""'. But I could rework it to remove the
    DG> incompatibility.

I don't think that's necessary.  In my own use, if I /know/ -a doesn't
have an argument (because I didn't specify as "a:"), then I never
check the optarg.  And it's bad form for a flag to take an optional
argument; it either does or it doesn't and you know that in advance.

-Barry