News for hackers. Stuff that matters.
Re:Opster: Pythonic option parsing by piranha on Monday September 14, 2009 @07:22PM (#822855)
Its API: it needs a lot of boiler plate code just to make it work, a lot of repetitions and it's object-oriented while there is no need in being so.
Re:Opster: Pythonic option parsing by mr_dbr on Tuesday September 15, 2009 @05:12PM (#824765)
A lot? There's about two lines I'd consider "boiler plate" (three if you count the import)

    from optparse import OptionParser

    parser = OptionParser() # initialise parser
    parser.add_option(...) # add option 1
    parser.add_option(...) # add option 2
    (options, args) = parser.parse_args() # run parser, get values
..and the sample add_option call:

    parser.add_option(
        "-q",
        "--quiet",
        action="store_false",
        dest="verbose",
        default=True,
        help="don't print status messages to stdout")
I don't see anything repetitive, nor unnecessarily object-oreiented
Re:Opster: Pythonic option parsing by piranha on Wednesday September 16, 2009 @04:16AM (#825465)
`action`, `dest` - this is particular examples of boiler plate. Why do I need to specify action if it's easily inferred from default value?