Namespaces/introspection: collecting sql strings for validation

Alex Martelli aleax at
Mon Apr 23 04:33:02 CEST 2007

Martin Drautzburg <Martin.Drautzburg at> wrote:
> The problem is the first part: how can I lookup the callers module and
> the classobjs defined in there? Or finding any constant strings in the
> caller's module would also be just fine. Or is there a completely
> different way to do such a thing?

Don't do black magic in production code.

For just hacking around, see sys._getframe -- it can give you a frame
object from where you can introspect into your caller's globals -- and
the inspect module of the standard Python library.

But don't put such black magic in production.  The completely different
way is: just don't.


More information about the Python-list mailing list