Georg Brandl wrote: > Am 31.01.2010 07:18, schrieb Nick Coghlan: >> Ben Finney wrote: >>> Could we instead have a single subdirectory for each tree of module >>> packages, keeping them tidily out of the way of the source files, while >>> making them located just as deterministically:: >> Not easily. With the scheme currently proposed in the PEP, setting a >> value for __file__ which is both reasonably accurate and backwards >> compatible with existing file manipulation techniques is >> straightforward: just use the name of the cache directory. > > Not really -- much of the code I've seen that tries to guess the source > file name from a __file__ value just does something like this: > > if fname.lower().endswith(('.pyc', '.pyo')): fname = fname[:-1] > > That's not compatible with using .pyr, either.
That's not the backwards compatibility I'm talking about - I'm talking about the more common one mentioned in the PEP where __file__ is used with os.path.split to locate adjacent resource files. Agreed that even the .pyr idea causes backwards compatibility problems with code like the above (fortunately we can fix the stdlib instances ourselves). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia --------------------------------------------------------------- _______________________________________________ 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