Vinay Sajip <vinay_sa...@yahoo.co.uk> added the comment: >[citation needed]. First, mutable objects with a global name (let’s not use > "variable" for Python) are not unconditionally evil; see sys.path and > sys.modules for example. Second, how concretely would you change that > implementation? We need shared caches for functions in packaging.database. > They should be built on demand, and should be cleared by higher-level > libraries or applications when the filesystem has changed (after an > installation or removal for example). With these constraints, do you have > implementation ideas?
I agree, we shouldn't have a knee-jerk reaction to global bindings - they definitely have their uses, and I'm sometimes driven to defend their use in logging. Since you ask, though - one possible approach might be: Have those bindings be instance variables in a Database class in database.py, and have a module-level binding to an instance of it. Then, tests can have their own instance which is thrown away aftereach test. This problem was not trivial to find, because it appears that test execution order may not be entirely deterministic: I couldn't see any other reason why the flag would have different values on different machines. I believe that you (Éric) had difficulty reproducing it. Perhaps we don't need to re-implement, but instead add more tests around cache invalidation and cache contents. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13193> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com