Closures

Michael Sparks zathras at thwackety.com
Thu Apr 29 18:17:01 EDT 2004


On Thu, 29 Apr 2004, Gustavo Niemeyer wrote:

> class Closure:
>     def __init__(self):
>         self.__dict__ = sys._getframe().f_back.f_locals

Out of interest how portable is this? Strikes me as extremely useful
class to have lying around :) The only thing that makes me wonder is the
access to _getframe...


Michael





More information about the Python-list mailing list