idiom for constructor?

Mac idontneednostinkinid at yahoo.com
Wed Jun 1 19:50:59 CEST 2005


Is there a nice Python idiom for constructors which would expedite the
following?

class Foo:
  def __init__(self, a,b,c,d,...):
    self.a = a
    self.b = b
    self.c = c
    self.d = d
    ...

I would like to keep the __init__ parameter list explicit, as is,
rather than passing in a dictionary, as I want the code to be explicit
about what arguments it expects... in effect enforcing the right number
of arguments.




More information about the Python-list mailing list