471,337 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

determining the source code and module based on the class

alf
Hi,

Let's say I have a class defined somewhere:

class A:
pass

now I import (indirectly) a module defining that class (and in fact
thousands of others defined in hundreds of modules) where all I have is
a list of them provided:

l=[A,B,C]
now I need a piece of code which based on the class name can point to
the module as well as the line number where the given class is defined.

Is it doable in Python?
--
alf
Jul 16 '07 #1
1 916
On Jul 16, 6:55 am, alf <ask@mewrote:
....
now I need a piece of code which based on the class name can point to
the module as well as the line number where the given class is defined.

Is it doable in Python?
look in the inspect module.

-- bjorn

Jul 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by M.E.Farmer | last post: by
66 posts views Thread by Darren Dale | last post: by
12 posts views Thread by johny smith | last post: by
6 posts views Thread by Paul Wilson | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.