def obj()
Terry Reedy
tjreedy at udel.edu
Thu Feb 8 17:10:04 EST 2007
"Gert Cuykens" <gert.cuykens at gmail.com> wrote in message
news:ef60af090702081349t41fbf8d5h118b4851a4b5b460 at mail.gmail.com...
| def obj():
| return {'data':'hello',
| 'add':add(v)}
v is undefined
| def add(v):
| data=data+v
data is undefined
| if __name__ == '__main__':
| test=obj()
| test.add('world')
test.add is undefined
| print test.data
test.data is undefined
| I don't know why but i have one of does none class c programing style
| moods again. I was wondering if the following was possible without
| using a class ?
I presume you meant 'foregoing' instead of 'following'. You can do
something similar with nested functions.
Terry Jan Reedy
More information about the Python-list
mailing list