On Mon, Jun 8, 2009 at 3:04 PM, Ronald Oussoren<ronaldoussoren@mac.com> wrote:
On 8 Jun, 2009, at 2:58, Tarek Ziadé wrote:
2009/6/7 Ronald Oussoren <ronaldoussoren@mac.com>:
* The global functions seem to maintain and modify global state, wouldn't this cause problems if I specify different values of the path arguments in different pieces of code?
The cache just prevents re-reading a directory content. Do you have a scenario in mind of a possible problem ? The only problem I can see is when a project is uninstalled by a program while these APIs are used by another program.
I guess the problem only occurs if "egg_infos" is part of the public interface. What if module A calls get_egg_infos(), then module B calls get_egg_infos(somePath), then module A uses "egg_infos" assuming that it still refers to the same set of paths.
I'll work on that.
There's also the issue of API complexity. The global functions don't add a lot to using an EggInfoDirectories object when you are working with a different set of paths than sys.path.
We have created collections to make it easy to use from a third party application that wants to work with the directories, and make it easy to bypass the cache. These global functions are just shortcuts for the most common usage and not really intended to do custom work. Maybe the paths argument could be completely removed si they are specialized for sys.path.
Ronald
-- Tarek Ziadé | http://ziade.org