[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/Acquisition

webmaster@zope.org webmaster@zope.org
Sat, 05 Apr 2003 23:19:17 -0500


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Acquisition.stx#2-9

---------------

    You can manually wrap an instance of an object that inherits from
    an acquisition base class by using its '__of__' method. For
    example::

      class A(Acquisition.Implicit):
          pass

      a=A()
      a.color='red'
      b=A()
      a.b=b

      print b.__of__(a).color # prints red

      % Anonymous User - Apr. 5, 2003 11:19 pm:
       Why the a.b=b here? Surely that statement should be omitted because it only confuses the issue.
       b.__of__(a).color will still return 'red' without it. The entire point of __of__() is to provide a context
       for an object, b in this case, and saying a.b=b also provides this context.