[Zope] getting base classes's (super class) _properties tuple

Andy McKay AndyM@ActiveState.com
Thu, 17 Aug 2000 11:35:27 -0700


class A:
    _properties = [ {'a':'A', 'aa':'AA'}, ]

class B(A):
    _properties = [ {'b':'B', 'bb':'BB'}, ]
    _properties = _properties + A._properties 
    
b = B()
print b._properties

Works for me.
-- 
     Andy McKay, Developer, ActiveState
     http://www.ActiveState.com
     Programming for the People


----- Original Message ----- 
From: "Daniel Rusch" <drusch@globalcrossing.com>
To: <zope@zope.org>
Sent: Thursday, August 17, 2000 11:30 AM
Subject: [Zope] getting base classes's (super class) _properties tuple


> Say I have a fully functional (and more importantly, working) Product
> will call A.
> 
> I want to extend this Product's capabilities so I wish to derive another
> 
> class from it, call it B.
> 
> No problem,
> 
> class B(A):
>     .........
> 
> now in class B I want to add a new property.
> 
> Is the a way of getting the base (super) class _properties tuple and
> just adding the new one to it. Since a tuple is an immutable object I
> can't do this:
> _properties=A._properties.append({'id':'RenderStandardHeader',
> 'type':'int','mode':'w'})
> 
> Any thoughts ????
> 
> DR
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>