R
Ron Garret
I encountered this code today (it's part of SqlAlchemy/Elixir) and it
kinda made me cringe:
# jam this statement into the class's statement list
class_locals = sys._getframe(1).f_locals
statements = class_locals.setdefault(STATEMENTS, [])
statements.append((self, args, kwargs))
Is this use of f_locals legitimate or is it a Horrible Hack? If it's
legitimate, where can I find documentation for how one is supposed to
use f_locals?
Thanks,
rg
kinda made me cringe:
# jam this statement into the class's statement list
class_locals = sys._getframe(1).f_locals
statements = class_locals.setdefault(STATEMENTS, [])
statements.append((self, args, kwargs))
Is this use of f_locals legitimate or is it a Horrible Hack? If it's
legitimate, where can I find documentation for how one is supposed to
use f_locals?
Thanks,
rg