def obj()

Gert Cuykens gert.cuykens at gmail.com
Thu Feb 8 17:17:42 EST 2007


On 2/8/07, Leif K-Brooks <eurleif at ecritters.biz> wrote:
> def obj():
>      result = {'data': 'hello'}
>      result['add'] = adder(result)
>      return result
>
> def adder(obj):
>      def add(value):
>          obj['data'] += value
>      return add
>
> if __name__ == '__main__':
>      test = obj()
>      test['add']('world')
>      print test['data']

Nice :) Does anybody know how this would look in c code ?



More information about the Python-list mailing list