Nick Coghlan <ncogh...@gmail.com> writes:

> This is also the reason why using the version number in the filename
> isn't adequate - the magic number can change due to more than just the
> Python version changing. Also, if we don't change the bytecode for a
> given release, then multiple versions can use the same magic number.
>
> Hiding these away in an appropriately named subfolder is the nicest
> way to handle it without cluttering the source code directory.

Thanks for the explanation. I eagerly await further information to the
contrary, but you've shown that it is at least likely to be better to
hide these files inside a subdirectory.


If a subdirectory is indeed the better solution, can we please ensure
that only *one* such subdirectory is created for the whole tree of
packages, instead of a new subdirectory per module?

In other words, my understanding is that the current PEP would have the
following tree for an example project::

    foo/
        __init__.py
        __init__.pyr/
            deadbeef.pyc
            decafbad.pyc
        lorem.py
        lorem.pyr/
            deadbeef.pyc
            decafbad.pyc
        ipsum/
            __init__.py
            __init__.pyr/
                deadbeef.pyc
                decafbad.pyc
            dolor.py
            dolor.pyr/
                deadbeef.pyc
                decafbad.pyc
            sit.py
            sit.pyr/
                deadbeef.pyc
                decafbad.pyc
            amet/
                __init__.py
                __init__.pyr/
                    deadbeef.pyc
                    decafbad.pyc
            malor.py
            malor.pyr/
                deadbeef.pyc
                decafbad.pyc
        wobble.py
        wobble.pyr/
            deadbeef.pyc
            decafbad.pyc
    bar/
        __init__.py
        __init__.pyr/
            deadbeef.pyc
            decafbad.pyc
        wibble.py
        wibble.pyr/
            deadbeef.pyc
            decafbad.pyc
        warble/
            __init__.py
            __init__.pyr/
                deadbeef.pyc
                decafbad.pyc
            wubble.py
            wubble.pyr/
                deadbeef.pyc
                decafbad.pyc
        wobble.py
        wobble.pyr/
            deadbeef.pyc
            decafbad.pyc

That's a nightmarish mess of compiled files swamping the source files,
as has been pointed out several times.

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::

    foo/
        .pyr/
            __init__/
                deadbeef.pyc
                decafbad.pyc
            lorem/
                deadbeef.pyc
                decafbad.pyc
            ipsum/
                __init__/
                    deadbeef.pyc
                    decafbad.pyc
                dolor/
                    deadbeef.pyc
                    decafbad.pyc
                sit/
                    deadbeef.pyc
                    decafbad.pyc
                amet/
                    __init__/
                        deadbeef.pyc
                        decafbad.pyc
                    spam/
                        deadbeef.pyc
                        decafbad.pyc
                malor/
                    deadbeef.pyc
                    decafbad.pyc
            wobble/
                deadbeef.pyc
                decafbad.pyc
        __init__.py
        lorem.py
        ipsum/
            __init__.py
            dolor.py
            sit.py
            amet/
                __init__.py
                spam.py
            malor.py
        wobble.py
    bar/
        .pyr/
            __init__/
                deadbeef.pyc
                decafbad.pyc
            wibble/
                deadbeef.pyc
                decafbad.pyc
            warble/
                __init__/
                    deadbeef.pyc
                    decafbad.pyc
                wubble/
                    deadbeef.pyc
                    decafbad.pyc
            wobble/
                deadbeef.pyc
                decafbad.pyc
        __init__.py
        wibble.py
        warble/
            __init__.py
            wubble.py
        wobble.py

-- 
 \        “It is seldom that liberty of any kind is lost all at once.” |
  `\                                                       —David Hume |
_o__)                                                                  |
Ben Finney

_______________________________________________
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

Reply via email to