On 07:41 am, p.may...@imperial.ac.uk wrote:
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.
Functions that take arguments are great. If your function takes *too
many* arguments then maybe the function does too many things or maybe
there is some structure spread across those arguments that should be
explicitly reflected in their type (iow maybe those last five arguments
are all actually part of the same thing and should be represented by a
single argument instead).
+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.
This is compatible with accepting these values as arguments. Defaults
that provide good behavior by default for the common case are great.
Jean-Paul
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python