What would be the equivalent to getfenv() in Python? Is there a way to get all available functions/variables in an environment?
Trying to see if something is sandboxed or not, which is why I am wondering this.
What would be the equivalent to getfenv() in Python? Is there a way to get all available functions/variables in an environment?
Trying to see if something is sandboxed or not, which is why I am wondering this.
I guess you are looking for globals()
>>> globals()
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', '__doc__': None, '__package__': None}
>>>
>>>
>>> foo = 1
>>> def bar():
... pass
...
>>> globals()
{'bar': <function bar at 0x102dd30c8>, '__builtins__': <module '__builtin__' (built-in)>, '__package__': None, '__name__': '__main__', 'foo': 1, '__doc__': None}