On 8 Jun, 2009, at 2:58, Tarek Ziadé wrote:
2009/6/7 Ronald Oussoren email@example.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.
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.