diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-03-07 23:42:16 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-03-07 23:42:16 +0100 |
| commit | 14da1d04da52ac665a244a73a62f9209304830ca (patch) | |
| tree | 746a48bcdd330443782ff4b4f8bbf08670473612 | |
| parent | info: concurrently (diff) | |
| download | join-python-14da1d04da52ac665a244a73a62f9209304830ca.tar.gz join-python-14da1d04da52ac665a244a73a62f9209304830ca.tar.bz2 join-python-14da1d04da52ac665a244a73a62f9209304830ca.tar.xz | |
info: working with classes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | info/join-python.texinfo | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/info/join-python.texinfo b/info/join-python.texinfo index df311eb..8d27320 100644 --- a/info/join-python.texinfo +++ b/info/join-python.texinfo @@ -54,7 +54,8 @@ Texts. A copy of the license is included in the section entitled * Signals:: The signal construct. * Fragments:: The fragment join construct. * Join-switches:: Advanced joining techniques. -* Fork–merge:: Running multiple functions concurrently synchronously +* Fork–merge:: Running multiple functions concurrently synchronously. +* Working with Classes:: Support for classes. * GNU Free Documentation License:: Copying and sharing this manual. @end menu @@ -308,6 +309,40 @@ In parallel +@node Working with Classes +@chapter Working with Classes + +If a signal or fragment is a part of a class, it is +automatically made into a static function. To make a +function into an instance function or instance method, +you need to decorate it with @code{@@joinmethod}. + +@cartouche +@example +>>> from join import * +>>> +>>> class Class: +>>> def __init__(self, value): +>>> self.value = value +>>> +>>> @@joinmethod +>>> @@fragment +>>> def fi(self): +>>> return self.value ** 3 +>>> +>>> @@fragment +>>> def fs(value): +>>> return value ** 3 +>>> +>>> Class.fs(2) +8 +>>> Class(2).fi() +8 +@end example +@end cartouche + + + @node GNU Free Documentation License @appendix GNU Free Documentation License @include fdl.texinfo |
