[Tutor] Adding dynamic methods (was RE: Function assignment)
Zak Arntson
zak@harlekin-maus.com
Fri Jun 13 12:15:02 2003
Even though it works, I'm still confused as to why ...
###
def msg(message):
def f():
return message
return f
###
... works. Here's what I DO understand:
>>> a = msg('testA')
This will call msg, passing in 'testA'. msg then creates a function f,
which returns 'testA'. Then msg returns that function f.
How does this look to the Python interpreter? I mean, where is 'testA'
stored?
Are there any good references as to how this works?
By the way, a big thanks to everyone who helped with the msg/attach stuff.
I'm looking forward to sharing the PyFict module with y'all.
---
Zak Arntson
www.harlekin-maus.com - Games - Lots of 'em