> On 03/02/2010 06:50, Barry Warsaw wrote: >> As to the question of sibling directories or folder-per-folder I think >> performance issues should be the deciding factor. There are file system >> limitations to consider (but also a wide variety of file systems in >> use). Do >> the number of stat calls predominate the performance costs? Maybe it >> makes >> sense to implement the two different approaches and do some measurements.
How about using an optionally relative cache dir setting to let the user decide ? import imp, os # Get cache dir, default to module_dir cache_dir = os.environ.get('PYTHONCACHEDIR', '.') # Get names and versions module_cache_type = 'pyc' module_cache_version = imp.get_magic().encode('hex') module_name = module.__name__ module_cache_file = '%s.%s.%s' % (module_name, module_cache_version, module_cache_type) module_dir = os.path.split(module.__file__)[0] # Determine cache dir and cache file pathname module_cache_dir = os.path.abspath(os.path.join(module_dir, cache_dir)) module_cache_pathname = os.path.join(module_cache_dir, module_cache_file) # Write PYC data to module_cache_pathname ... -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 03 2010) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com