1.1 --- a/docs/structures.txt Sun Feb 08 23:48:47 2009 +0100
1.2 +++ b/docs/structures.txt Mon Feb 09 01:09:42 2009 +0100
1.3 @@ -13,8 +13,28 @@
1.4 object context
1.5 reference reference
1.6
1.7 -Values and Contexts
1.8 --------------------
1.9 +Such values are used as the stored representations of attributes (of classes,
1.10 +instances, modules, and other objects supporting attribute-like entities) as
1.11 +well as the stored values associated with names in functions and methods.
1.12 +
1.13 +Stored Values and Contexts
1.14 +--------------------------
1.15 +
1.16 +In a program image, generated attribute data will employ values, and these
1.17 +values will generally have the following context definitions according to the
1.18 +type of the referenced objects:
1.19 +
1.20 + Referenced Object Type Context
1.21 + ---------------------- -------
1.22 +
1.23 + Function None
1.24 +
1.25 + Method Parent object (class)
1.26 +
1.27 + Class None
1.28 +
1.29 +Value and Context Transformations
1.30 +---------------------------------
1.31
1.32 Values are acquired through name lookups and attribute access, yielding
1.33 the appropriate object reference together with a context reference as
2.1 --- a/rsvp.py Sun Feb 08 23:48:47 2009 +0100
2.2 +++ b/rsvp.py Mon Feb 09 01:09:42 2009 +0100
2.3 @@ -332,7 +332,7 @@
2.4 # NOTE: Referencing the instance template.
2.5 addr = self._MakeObject(size, ref - 1)
2.6 # Introduce object as context for the new object.
2.7 - self.value = None, addr
2.8 + self.value = addr, addr
2.9
2.10 def LoadAttr(self):
2.11 context, ref = self.value
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/tests/call_instance2.py Mon Feb 09 01:09:42 2009 +0100
3.3 @@ -0,0 +1,15 @@
3.4 +#!/usr/bin/env python
3.5 +
3.6 +class C:
3.7 + def __call__(self):
3.8 + return "called"
3.9 +
3.10 +class D:
3.11 + def __init__(self, x):
3.12 + self.x = x
3.13 +
3.14 +c = C()
3.15 +d = D(c)
3.16 +d.x()
3.17 +
3.18 +# vim: tabstop=4 expandtab shiftwidth=4