Re: def obj()

2007-02-08 Thread Gert Cuykens
#include function hello(){ struct obj = { char *data = 'hello'} obj.add = obj_add(obj); return obj; } function obj_add(obj){ function add(value){ obj.data += value; return obj; } } main(){ test = hello(); test.add('world'); printf(test.data); } I

Re: def obj()

2007-02-08 Thread Gert Cuykens
On 2/8/07, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > def obj(): > result = {'data': 'hello'} > result['add'] = adder(result) > return result > > def adder(obj): > def add(value): > obj['data'] += va

Re: def obj()

2007-02-08 Thread Terry Reedy
"Gert Cuykens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | def obj(): |return {'data':'hello', |'add':add(v)} v is undefined | def add(v): |data=data+v data is undefined | if __name__ == '__main__

Re: def obj()

2007-02-08 Thread Leif K-Brooks
Gert Cuykens wrote: > def obj(): >return {'data':'hello', >'add':add(v)} > > def add(v): >data=data+v > > if __name__ == '__main__': >test=obj() >test.add('world') >print t

def obj()

2007-02-08 Thread Gert Cuykens
def obj(): return {'data':'hello', 'add':add(v)} def add(v): data=data+v if __name__ == '__main__': test=obj() test.add('world') print test.data I don't know why but i have one of does none class