# an example use case for the as-yet mythical sugar.garden package.
from sugar.garden import Shared
from sugar.garden import sharedmethod
class SketchPad(Shared):
@sharedmethod
def somefunc(self):
self.someattr = 42;
def anotherfunc(self):
self.anotherattr = self.someattr + 1
# I would use the SketchPad object something like this:
# instantiation would automatically set up sharing. obviously for joining existing activities a different incantation would be necessary.
mysketch = SketchPad()
# since instance operations are decorated, they don't require transaction blocks to be used.
mysketch.somefunc()
mysketch.begintransaction()
mysketch.someattr = 300
mysketc.endtransaction()