summaryrefslogtreecommitdiff
path: root/lib/Pb/inspect_objects_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Pb/inspect_objects_example.py')
-rw-r--r--lib/Pb/inspect_objects_example.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Pb/inspect_objects_example.py b/lib/Pb/inspect_objects_example.py
new file mode 100644
index 0000000..92e28b7
--- /dev/null
+++ b/lib/Pb/inspect_objects_example.py
@@ -0,0 +1,15 @@
+class Test(object):
+ def __init__(self, one="la", two="di"):
+ self._test_args(inspect.getargvalues(inspect.currentframe()));
+
+ def _test_args(self, _args_vals):
+ for arg in _args_vals.args:
+ if arg == "self":
+ continue
+ try:
+ sys.stdout.write("%s\n" % arg)
+ sys.stdout.write("\t%s\n" % _args_vals.locals.get(arg))
+ except Exception as e:
+ sys.stderr.write("%s\n" % e );
+
+t = Test();