[Python-ideas] Options parsing in the Tornado Web Server

Andrey Fedorov anfedorov at gmail.com
Thu Sep 10 22:52:24 CEST 2009


Well, options.*port* corresponds to define("*port*", ...). Is it considered
unPythonic to equate variable names and strings? I didn't think it was,
since scopes are dictionaries...

Good point about options.options.

- Andrey

On Thu, Sep 10, 2009 at 4:44 PM, Guido van Rossum <guido at python.org> wrote:

> That's not particularly more expressive than what optparse gives you
> today, except for the use of a function with a side effect on a magic
> global (how the heck did options.port suddenly get a value?!) and the
> potential for confusing tornado.options with tornado.options.options.
>
> On Thu, Sep 10, 2009 at 12:50 PM, Andrey Fedorov <anfedorov at gmail.com>
> wrote:
> > I remember seeing a bit of discussion about improving Python's default
> > options parsing... Tornado's seems very impressive [1]:
> >>
> >> from tornado.options import define, options
> >>
> >> define("port", default=8888, help="run on the given port", type=int)
> >>
> >> print options.port
> >
> > What does everyone think?
> >
> > - Andrey
> >
> > 1.
> >
> http://github.com/facebook/tornado/blob/9a8bd2fb6fd6279be16d6f0a2e57e49fe1b98f8f/demos/chat/chatdemo.py
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/<http://www.python.org/%7Eguido/>
> )
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090910/1b744244/attachment.html>


More information about the Python-ideas mailing list