getting the name of a generator function
Oscar Rambla
tecnic at codidoc.com
Wed Jun 11 12:40:02 EDT 2003
Duncan answered:
>Did you mean how do you get "f1" from g2? If so, try:
>>> inspect.getframeinfo(g2.gi_frame)[2]
'f1'
Thank you, i must admit inspect module is still unknown for me. I must take a
lot on it inmediatly!
>Although it escapes me WHY you would want to do this.
I want to handle a collection of generators to maintain state and some sort
of task flow between cgi requests while interacting with quixote. (Look at
its mailing list if you feel curious )
As an alternative, I was taking a look at the 'generator attributes' PEP 288
implementation. But i still have some troubles with it.
I think your suggestion will be enough for now.
--Oscar
More information about the Python-list
mailing list