[Twisted-Python] Configuration options for twisted code

Phil Mayers p.mayers at imperial.ac.uk
Tue Mar 4 00:41:10 MST 2014


On 04/03/2014 00:52, Itamar Turner-Trauring wrote:
> On 03/03/2014 01:09 PM, Adi Roiban wrote:
>>
>> What do you think? Should I go ahead and add options as __init__
>> arguments or think of a configuration system?
>>
>
> A configuration system would take a while to design and meanwhile these
> unrelated features would languish, so I'd suggest you start with options
> to __init__.

-1

I hate __init__ methods with a hojillion parameters, and that's where 
this leads.

+1 instead for class variables which can be overridden in sub-classes to 
achieve DRY and/or set after instantiation if necessary e.g.

class Foo:
   maxThingLen = 10000

class MyFoo(Foo):
   maxThingLen = 100

This is also somewhat consistent with what things like t.w.s.Site 
already do.



More information about the Twisted-Python mailing list