f_locals

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top