Opened 7 years ago

#6851 enhancement new

Options HOWTO shouldn’t use underbars in example parameter names

Reported by: Wilfredo Sánchez Vega Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:


The options HOWTO uses underbars in example parameter names:

class Options(usage.Options):
    optParameters = [
            ["shiny_integer", "s", 1, None, int],
            ["dummy_float", "d", 3.14159, None, float],

Which is fine, except if you were to try to code those up as opt_* methods instead, for example:

class Options(usage.Options):
    def opt_shiny_integer(self, value):

This seems like it’s obviously equivalent, but instead of creating a shiny_integer parameter in the second example, Options will create a shiny-integer parameter.

Which means that if you use underbars in parameter names, you have to use optParameters and can’t later switch to an opt_* method.

It also means that we are encouraging one convention in the HOWTO, but a different one in the Options implementation.

In twistd itself this lack of a common convention is unfortunately evident (--no_save vs. --help-reactors).

We should pick a team. Team Hyphens seems to win on the flexibility to use either method for defining parameters, so I’d pick that team.

Change History (0)

Note: See TracTickets for help on using tickets.