[Zope3-Users] Re: Newbie Question

Philipp von Weitershausen philipp at weitershausen.de
Sat Feb 24 10:10:18 EST 2007


On 24 Feb 2007, at 16:05 , Edward Muller wrote:
> By initializing attributes in the constructor do you mean:
>
> A)
>
> class IA():
> 	""" The Letter A """
>
> 	letter = zope.schema.TextLine(title="The Letter A")
>
> class A():
> 	implements(IA)
>
> 	def __init__(self,...):
> 		letter = A

This is pretty ineffective, it doesn't store 'letter' on self.

>
> or
> B)
>
> class A()
> 	implements(IA)
>
> 	def __init__(self,...):
> 		self.letter = A

I mean that. Actually, I mean:

class A:
     implements(IA)

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

perhaps with default values for a,b,c if it makes sense for you.





More information about the Zope3-users mailing list