[Python-Dev] Should there be a way or API for retrieving from a code object a loader method and package file where the code comes from? (original) (raw)

R. Bernstein rocky at panix.com
Tue Dec 23 17:55:00 CET 2008


Nick Coghlan writes:

  1. Do what a number of standard library APIs (e.g. linecache) that accept filenames do and also accept an optional "module globals" argument.

Actually, I did this and committed a change (to pydb) before posting any of these queries. ;-)

If "a number of standard library APIs" are doing the same thing, then shouldn't this exposed as a common routine?

If on the other hand, by "a number" you mean "one" as in linecache -- 1 is a number too! -- then perhaps the relevant code that is buried inside the "updatecache" should be exposed on its own. (As a side benefit that code can be tested separately too!)

Should I file a feature request for this?



More information about the Python-Dev mailing list