Commit 6af7fe05 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

Add example

parent a2e21cb9
...@@ -60,9 +60,21 @@ def log (message, subsystem): ...@@ -60,9 +60,21 @@ def log (message, subsystem):
server_log = functional.partial(log, subsystem='server') server_log = functional.partial(log, subsystem='server')
\end{verbatim} \end{verbatim}
Here's another example, from a program that uses PyGTk. Here's another example, from a program that uses PyGTk. Here a
context-sensitive pop-up menu is being constructed dynamically. The
callback provided for the menu option is a partially applied version
of the \method{open_item()} method, where the first argument has been
provided.
% XXX add example from my GTk programming \begin{verbatim}
...
class Application:
def open_item(self, path):
...
def init (self):
open_func = functional.partial(self.open_item, item_path)
popup_menu.append( ("Open", open_func, 1) )
\end{verbatim}
\begin{seealso} \begin{seealso}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment