1.1 --- a/docs/invocation.txt Fri Nov 29 01:17:17 2013 +0100
1.2 +++ b/docs/invocation.txt Fri Nov 29 01:38:25 2013 +0100
1.3 @@ -212,6 +212,18 @@
1.4 -> load context for argument #1 (f, since an instance is referenced)
1.5 obj -> argument #2
1.6
1.7 +Dynamic default information and methods:
1.8 +
1.9 + class C:
1.10 + def f(self, y=nonconst):
1.11 + ...
1.12 +
1.13 + Defines additional context for the method:
1.14 +
1.15 + class C:
1.16 + def f(<context>, self, y=nonconst):
1.17 + ...
1.18 +
1.19 Functions as methods:
1.20
1.21 def f(x, y, z): ...
2.1 --- a/docs/syspython.txt Fri Nov 29 01:17:17 2013 +0100
2.2 +++ b/docs/syspython.txt Fri Nov 29 01:38:25 2013 +0100
2.3 @@ -23,14 +23,32 @@
2.4 or method. Note that the apply function resembles the Python function of the
2.5 same name but is not actually that particular function.
2.6
2.7 + apply(fn, ...) # general invocation
2.8 +
2.9 A family of special functions for invocations exists, addressing optimisation
2.10 situations identified by program analysis:
2.11
2.12 - apply # general invocation
2.13 - applyclass # direct invocation of an instantiator
2.14 - applyfunction # function-specific invocation
2.15 - applystaticmethod # specific invocation of a method via a class
2.16 - applymethod # specific invocation of a method via self
2.17 + applyclass(cls, ...) # direct invocation of an instantiator
2.18 + applyfunction(fn, ...) # function-specific invocation
2.19 + applystaticmethod(fn, obj, ...) # specific invocation of a method via a class
2.20 + applymethod(fn, obj, ...) # specific invocation of a method via self
2.21 +
2.22 +Where dynamic functions are to be invoked, the context providing the defaults
2.23 +needs to be supplied to the function or method, but this can be done using the
2.24 +above special functions as follows:
2.25 +
2.26 + applyclass(cls, __context__, ...)
2.27 + applyfunction(fn, __context__, ...)
2.28 + applystaticmethod(fn, __context__, obj, ...)
2.29 + applymethod(fn, __context__, obj, ...)
2.30 +
2.31 +Where optimisation possibilities cannot be identified in advance, the apply
2.32 +function must deal with the following aspects of invocation:
2.33 +
2.34 + * Whether a context argument is required
2.35 + * Whether a dynamic function is being invoked, thus requiring a context for
2.36 + access to defaults
2.37 + * Whether an appropriate number of arguments have been provided
2.38
2.39 Low-Level Code
2.40 --------------