By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,235 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,235 IT Pros & Developers. It's quick & easy.

the inspect thing

P: n/a
-----the code:
class A:

import inspect
print inspect.getsource(A)

class A:
print inspect.getsource(A)

-----unavailable from the console, but gets you:
class A:

class A:

One thought is, in inspect, could at least:
def findsource(object):
if candidates:
# this will sort by whitespace, and by line number,
# less whitespace first
return lines, candidates[0][1]
return lines, candidates[-1][1]
to get the most recent?

Why no cl_firstlineno in the object for the class, or access to the

May 10 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.