On Sun, Jan 31, 2010 at 11:16, Guido van Rossum <gu...@python.org> wrote: > Whoa. This thread already exploded. I'm picking this message to > respond to because it reflects my own view after reading the PEP. > > On Sun, Jan 31, 2010 at 4:13 AM, Hanno Schlichting <ha...@hannosch.eu> wrote: >> On Sun, Jan 31, 2010 at 1:03 PM, Simon Cross >> <hodgestar+python...@gmail.com> wrote: >>> I don't know whether I in favour of using a single pyr folder or not >>> but if a single folder is used I'd definitely prefer the folder to be >>> called __pyr__ rather than .pyr. > > Exactly what I would prefer. I worry that having many small > directories is a fairly poor use of the filesystem. A quick scan of > /usr/local/lib/python3.2 on my Linux box reveals 1163 .py files but > only 57 directories). > >> Do you have any specific reason for that? >> >> Using the leading dot notation is an established pattern to hide >> non-essential information from directory views. What makes this >> non-applicable in this situation and a custom Python notation better? > > Because we don't want to completely hide the pyc files. Also the dot > naming convention is somewhat platform-specific. > > FWIW in Python 3, the __file__ variable always points to the .py > source filename. I agreed with Georg that there ought to be an API for > finding the pyc file for a module. This could be a small addition to > the PEP.
Importlib somewhat does this already through a module's loader: http://docs.python.org/py3k/library/importlib.html#importlib.abc.PyPycLoader.bytecode_path . If you want to work off of module names this is enough; if importlib did the import then you can do __loader__.bytecode_path(__name__). And if it has not been loaded yet then that simply requires me exposing an importlib.find_module() that returns a loader for the module. Trick comes down to when you want it based on __file__ instead of the module name. Oh, and me finally breaking up import so that it has proper loaders or bootstrapping importlib; small snag. =) But at least the code already exists for this stuff. -Brett > > -- > --Guido van Rossum (python.org/~guido) > _______________________________________________ > 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/brett%40python.org > _______________________________________________ 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