From 14da1d04da52ac665a244a73a62f9209304830ca Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 7 Mar 2014 23:42:16 +0100 Subject: info: working with classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- info/join-python.texinfo | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'info/join-python.texinfo') 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 -- cgit v1.2.3-70-g09d2