Diff of /doc/source/about_pyke/cooking_functions.txt [9ac085] .. [0176eb] Maximize Restore

  Switch to unified view

a/doc/source/about_pyke/cooking_functions.txt b/doc/source/about_pyke/cooking_functions.txt
...
...
48
48
49
First you define the function that you want to cook with an extra parameter
49
First you define the function that you want to cook with an extra parameter
50
at the start:
50
at the start:
51
51
52
    >>> def foo(cooked, standard):
52
    >>> def foo(cooked, standard):
53
    ...     print "foo called with cooked: %s, standard: %s" % \
53
    ...     print("foo called with cooked: %s, standard: %s" %
54
    ...               (cooked, standard)
54
    ...               (cooked, standard))
55
55
56
Now you can call this function with two parameters:
56
Now you can call this function with two parameters:
57
57
58
    >>> foo('a', 'b')
58
    >>> foo('a', 'b')
59
    foo called with cooked: a, standard: b
59
    foo called with cooked: a, standard: b
...
...
105
105
106
This same technique can be used to cook a function call graph, by making the
106
This same technique can be used to cook a function call graph, by making the
107
subordinate function a cooked parameter:
107
subordinate function a cooked parameter:
108
108
109
    >>> def bar(child_fun, a):
109
    >>> def bar(child_fun, a):
110
    ...     print "bar called with:", a
110
    ...     print("bar called with:", a)
111
    ...     return child_fun(a)
111
    ...     return child_fun(a)
112
112
113
And now you can cook which function ``bar`` calls the same way you cook any
113
And now you can cook which function ``bar`` calls the same way you cook any
114
other parameter:
114
other parameter:
115
115