[Twisted-Python] usage.Options

Andrew Bennetts andrew-twisted at puzzling.org
Fri Oct 4 03:26:51 EDT 2002


I'm looking at warner's manhole doc at
    http://www.lothar.com/tech/twisted/manhole.xhtml
(which is excellent, btw)

This code snippet struck me as silly:
    # add manhole with username and password
    from twisted.tap.manhole import Options, updateApplication
    o = Options()
    o.parseOptions(["--user", "boss", "--password", "sekrit"])
    updateApplication(app, o)

I'm tempted to wonder if this would be better (if it were implemented in
usage.Options, of course...):
    # add manhole with username and password
    from twisted.tap.manhole import Options, updateApplication
    updateApplication(app, Options(user='boss', password='sekrit'))

i.e. let usage.Options' __init__ take a **kwargs, and have it pass that
to parseOptions.  It seems to me that constructing and configuring an
Options instance at the same time is a natural thing to do.

Does this sound like a good idea?

-Andrew.





More information about the Twisted-Python mailing list