Message82755
optparse's OptionParser takes a usage string as a constructor argument,
in which a "%prog" token is replaced with the executable name. Nice
idea, but the choice of a percent sign for token delimiter is
troublesome since it means that attempting to substitute any variables
into the usage string, e.g.
usage = """
%prog [options] foo bar ...
Some computed info: %s""" % myinfo
gives a ValueError:
ValueError: unsupported format character 'p' (0x70) at index 2
Maybe this ceases to be a problem with what I've heard about the
formatting re-design in Python 3.x, but it will probably continue to be
awkward for the 2.x series where the "%" operator still applies. Maybe
optparse could also use a safer token ("@prog", say), so that those of
use who would like to substitute variables into usage strings don't have
to artificially break our strings apart every time we use the program name? |
|
Date |
User |
Action |
Args |
2009-02-26 14:08:21 | andybuckley | set | recipients:
+ andybuckley |
2009-02-26 14:08:20 | andybuckley | set | messageid: <1235657301.0.0.570372518506.issue5374@psf.upfronthosting.co.za> |
2009-02-26 14:08:19 | andybuckley | link | issue5374 messages |
2009-02-26 14:08:18 | andybuckley | create | |
|