C
castironpi
-----the code:
class A:
b=2
import inspect
print inspect.getsource(A)
class A:
c=2
print inspect.getsource(A)
-----unavailable from the console, but gets you:
class A:
b=2
class A:
b=2
One thought is, in inspect, could at least:
def findsource(object):
#snip
if candidates:
# this will sort by whitespace, and by line number,
# less whitespace first
candidates.sort()
return lines, candidates[0][1]
be
return lines, candidates[-1][1]
to get the most recent?
Why no cl_firstlineno in the object for the class, or access to the
code?-acb
class A:
b=2
import inspect
print inspect.getsource(A)
class A:
c=2
print inspect.getsource(A)
-----unavailable from the console, but gets you:
class A:
b=2
class A:
b=2
One thought is, in inspect, could at least:
def findsource(object):
#snip
if candidates:
# this will sort by whitespace, and by line number,
# less whitespace first
candidates.sort()
return lines, candidates[0][1]
be
return lines, candidates[-1][1]
to get the most recent?
Why no cl_firstlineno in the object for the class, or access to the
code?-acb