You can clone with
With a simple flag we could be able to change an existing option later in code
def define(self, name, default=None, type=None, help=None, metavar=None,
multiple=False, group=None, mutable=False):
if name in self and not mutable:
Why would you want to do that?
Sometimes I like to redefine some of the site options. For example: if I define list display order as descending, and reference that option when creating the list, id like to give a user the opportunity to order the list in a different way. Since I originally used an option to define order and used it throughout the code, I have to redefine the option for it to take.
I've been using:
from tornado.options import options, _Option
options['name'] = _Option(name, default=new_value, ...)
Just figured it could be easier.
For your example about list display order, it sounds like the right answer is for the display function to take an order argument instead of relying on the global option. Redefining anything but the default value in this way seems dangerous. Since tornado 2.3 it's been possible to say "options.name = new_value", which should be good enough. Is there any reason I'm missing to redefine the option with a new default instead of just setting it to a new value?