Hi all,
Developing a project, I have portions that work and should be assembled
into a final program. Some parts don't interconnect when they should,
because of my lack of rigor in managing versions. So in order to get on,
I should next tidy up the mess and the way I can think of to do it is to
read out the source file names of all of a working component's elements,
then delete unused files and consolidate redundancy.
So, the task would be to find source file names. inspect.getsource ()
knows which file to take the source from, but as far as I can tell, none
of its methods reveals that name, if called on a command line (>>>
inspect.(get source file name) ()). Object.__module__ works.
Module.__file__ works, but Object.__module__.__file__ doesn't, because
Object.__module__ is only a string.
After one hour of googling, I believe inspect() is used mainly at
runtime (introspection?) for tracing purposes. An alternative to
inspect() has not come up. I guess I could grep inspect.(getsource ()),
but that doesn't feel right. There's probably a simpler way. Any
suggestions?
Frederic
--
https://mail.python.org/mailman/listinfo/python-list