10 if attr
.startswith('co_'):
11 val
= getattr(obj
, attr
)
12 print "\t", attr
, repr(val
)
21 def walk(co
, match
=None):
22 if match
is None or co
.co_name
== match
:
26 for obj
in co
.co_consts
:
27 if type(obj
) == types
.CodeType
:
30 def load(filename
, codename
=None):
31 co
= loadCode(filename
)
34 if __name__
== "__main__":
36 if len(sys
.argv
) == 3:
37 filename
, codename
= sys
.argv
[1:]
39 filename
= sys
.argv
[1]
41 if filename
.endswith('.py'):
42 buf
= open(filename
).read()
43 co
= compile(buf
, filename
, "exec")
46 load(filename
, codename
)