[Zope-dev] _getOb or __getattr__?

Jeffrey P Shell jeffrey@Digicool.com
Tue, 27 Feb 2001 11:06:04 -0500


On 2/27/01 10:59 AM, in article 3A9BCED9.A94826E@nipltd.com, "Chris Withers"
<chrisw@nipltd.com> wrote:

> Hi,
> 
> I need a product with custom attribute getting code and so looked to the
> BTreeFolder product for inspiration.
> 
> It implements both __getattr__ and _getOb which appear to do roughly the same
> thing.
> 
> What's the difference?
> 
> Shane hints that __getattr__ is slower but allows acquisiton. Why is that?

_getOb and _setOb are for placing subobjects somewhere besides attributes
(which is the default implementation).

_getOb and friends are the default protocol that *SHOULD* be used by systems
that change subobjects (ie - copy and paste).

Jeffrey P Shell, jeffrey@Digicool.com
http://www.digicool.com/ | http://www.zope.org