From VM Thu Jan 25 10:43:52 2007 Content-Length: 3657 X-VM-v5-Data: ([nil nil nil t nil nil nil nil nil] ["3657" "Saturday" "1" "February" "2003" "12:52:18" "-0000" "James Kew" "james.kew@btinternet.com" nil "92" "[Python-Dev] Re: New version of PEP 304" "^From:" nil nil "2" nil "[Python-Dev] Re: New version of PEP 304" nil nil nil nil nil nil nil] nil) Return-Path: Received: from localhost [127.0.0.1] by localhost with POP3 (fetchmail-6.1.0) for skip@localhost (single-drop); Sun, 02 Feb 2003 08:48:03 -0600 (CST) Received: from icicle.pobox.com (icicle-mx.pobox.com [199.26.64.83]) by manatee.mojam.com (8.12.1/8.12.1) with ESMTP id h126NCQW027119 for ; Sun, 2 Feb 2003 00:23:12 -0600 Received: from icicle.pobox.com (localhost [127.0.0.1]) by icicle.pobox.com (Postfix) with ESMTP id 2C3DE23E6C for ; Sun, 2 Feb 2003 01:23:12 -0500 (EST) Delivered-To: skip@pobox.com Received: from mail.python.org (mail.python.org [12.155.117.29]) by icicle.pobox.com (Postfix) with ESMTP id BBD6B23E77 for ; Sun, 2 Feb 2003 01:23:11 -0500 (EST) Received: from localhost.localdomain ([127.0.0.1] helo=mail.python.org) by mail.python.org with esmtp (Exim 4.05) id 18fDWy-0003jm-00; Sun, 02 Feb 2003 01:23:04 -0500 Received: from main.gmane.org ([80.91.224.249]) by mail.python.org with esmtp (Exim 4.05) id 18fDWZ-0003g1-00 for python-dev@python.org; Sun, 02 Feb 2003 01:22:39 -0500 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18exG2-0006Qg-00 for ; Sat, 01 Feb 2003 14:00:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18ex6M-0005nO-00 for ; Sat, 01 Feb 2003 13:50:30 +0100 Lines: 86 Message-ID: References: <15930.46189.483674.745097@montanaro.dyndns.org> X-Complaints-To: usenet@main.gmane.org X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Status: No, hits=-1.2 required=5.0 tests=BODY_PYTHON_ZOPE,FORGED_RCVD_FOUND,PRIORITY_NO_NAME,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01 X-Spam-Level: Errors-To: python-dev-admin@python.org X-BeenThere: python-dev@python.org X-Mailman-Version: 2.0.13 (101270) Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Python core developers List-Unsubscribe: , List-Archive: X-Spambayes-Debug: '*H*': 1.00; '*S*': 0.00; 'cc:addr:python.org': 0.00; 'python-dev': 0.00; 'url:python-dev': 0.00; 'email name:python-dev': 0.00; 'cc:addr:python-list': 0.00; 'wrote:': 0.00; 'python': 0.00; 'subject:Dev': 0.00; 'none,': 0.00; 'subject:PEP': 0.00; 'undefined': 0.00; 'url:peps': 0.01; 'subject:version': 0.01; 'specifies': 0.01; 'hierarchy': 0.01; 'implicit': 0.01; 'bytecode': 0.01; 'defined,': 0.01; 'to:addr:python-dev': 0.01; 'pep': 0.01; 'filesystem': 0.01; 'header:X-Complaints-To:1': 0.01; 'module': 0.01; 'silently': 0.01; 'subject:Python': 0.01; 'magically': 0.02; 'message-id:@main.gmane.org': 0.02; "'/'": 0.02; "file's": 0.02; 'tweaking': 0.02; 'subject:] ': 0.02; 'url:listinfo': 0.02; 'augmented': 0.02; 'ok:': 0.02; 'unexpectedly': 0.02; 'windows).': 0.02; 'message:': 0.02; 'url:python': 0.02; 'unix.': 0.02; 'email addr:python.org': 0.02; 'case:': 0.02; 'url:mailman': 0.02; 'behaviour': 0.02; 'startup.': 0.03; ';-)': 0.03; 'cc:no real name:2**0': 0.03; 'skip:_ 40': 0.03; 'define': 0.03; 'systemwide': 0.03; 'montanaro': 0.04; 'suggestion:': 0.04; 'default': 0.04; 'import': 0.05; 'variable': 0.05; 'subject:[': 0.05; 'to:addr:python.org': 0.05; 'implemented': 0.05; 'url:org': 0.07; 'skip': 0.07; '(either': 0.07; 'header:Errors-To:1': 0.07; 'header:Received:8': 0.07; 'correct': 0.07; 'directory': 0.09; 'url:mail': 0.09; '"root': 0.09; '(are': 0.09; 'drive"': 0.09; 'kew': 0.09; 'redefine': 0.09; 'side-effect,': 0.09; 'specifier': 0.09; 'unix': 0.10; 'file': 0.10; 'root': 0.10; 'windows.': 0.11; 'directory.': 0.13; 'terminology': 0.13; 'windows,': 0.14; "i'm": 0.14; "doesn't": 0.14; 'yields': 0.16; 'mean': 0.17; 'checked': 0.17; 'environment': 0.17; 'welcome.': 0.17; 'done.': 0.18; 'oh,': 0.18; 'cc:2**0': 0.18; 'programmers': 0.18; 'subject:: ': 0.19; 'added': 0.19; 'generated': 0.20; 'same.': 0.20; 'startup': 0.21; 'typically': 0.21; 'version': 0.21; 'subject:-': 0.21; 'leaving': 0.21; 'bit': 0.22; 'something': 0.22; 'windows': 0.22; 'it?': 0.22; 'interpreted': 0.23; 'appropriate': 0.24; "there's": 0.24; 'mailing': 0.24; 'be.': 0.24; 'compiled': 0.24; 'but': 0.24; 'one.': 0.25; 'skip:" 10': 0.26; 'warning': 0.26; 'set': 0.27; 'directory,': 0.27; 'entirely': 0.27; 'point': 0.27; 'which': 0.28; 'list': 0.28; 'when': 0.28; 'written': 0.29; 'should': 0.29; 'case': 0.29; 'bullet': 0.29; 'skip:c 30': 0.30; 'normally': 0.30; '-->': 0.30; 'sure': 0.30; 'know': 0.30; 'same': 0.30; 'does': 0.30; 'bases': 0.31; 'multiple': 0.31; 'james': 0.31; 'skip:s 10': 0.31; 'what': 0.31; 'imply': 0.32; 'source': 0.32; 'slight': 0.32; 'could': 0.33; 'then': 0.33; 'way': 0.33; 'alongside': 0.68; 'instead,': 0.68; 'url:html': 0.68; 'url:www': 0.69; 'pfxlen:1': 0.73; 'skip:c 20': 0.77; 'further,': 0.78; '"during': 0.84 From: "James Kew" Sender: python-dev-admin@python.org To: python-dev@python.org Cc: python-list@python.org Subject: [Python-Dev] Re: New version of PEP 304 Date: Sat, 1 Feb 2003 12:52:18 -0000 X-Spambayes-Classification: ham; 0.00 Skip Montanaro wrote: > I just checked in a new version of PEP 304. It should be available at > > http://www.python.org/peps/pep-0304.html > >> Feedback welcome. Windows C programmers even more welcome. ;-) Cosmetic: there's a System Message: WARNING on the fourth bullet point of "Proposal". Serious: I'm not sure this covers all the bases on Windows, which has multiple filesystem roots. Specifically, it doesn't preserve the current behaviour if PYTHONBYTECODEBASE is not set and if the "startup drive" and the drive on which a Python source file is located is not the same. > If not defined, Python bytecode is generated in exactly the same way as is currently done. > sys.bytecodebase is set to the > root directory (either / on Unix or the root directory of the > startup drive -- typically C:\ -- on Windows). Need to define "startup drive" precisely -- I assume something "the drive from which the system is booted" or "the drive on which the operating system is installed" (are these always the same?) but I don't know what the correct terminology would be. "Startup drive" could be misinterpreted as "the drive on which Python is installed", given that in the rest of the PEP "startup" refers to Python or program startup. OK: so if I don't set PYTHONBYTECODEBASE, sys.bytecodebase is set to C:\. Now, what happens if I import a module which happens to be in, oh, for example, D:\Roundup\MyTracker\config.py and which does not currently have compiled bytecode alongside it? > When the bytecode base is not None, a new bytecode file is written to the appropriate augmented directory BANG. The compiled bytecode is written not to D:\Roundup\MyTracker\config.pyc as I would expect it to: instead, it's magically and silently written to the "augmented" directory C:\D\Roundup\MyTracker\config.pyc -- as a side-effect, unexpectedly creating an new directory hierarchy on C:. This needs to be fixed so that, on Windows, leaving PYTHONBYTECODEBASE undefined yields the current behaviour as default -- as is already the case when this PEP is implemented under Unix. A suggestion: define a sys.bytecodebase of '/' to mean "default behaviour" on Windows. This would normally be interpreted as "root of the current drive" -- it's a little bit of a stretch to redefine it in this case as "root of the source file's drive", but not unreasonable. Taking this further, one could define that, on Windows, a sys.bytecodebase containing a drive specifier specifies a single, systemwide bytecode directory, with implicit directory augmentation; and that a sys.bytecodebase that does not contain a drive specifier specifies a per-drive bytecode directory. Thus: sys.bytecodebase = "C:\Bytecode" C:\MyStuff\script.py --> C:\Bytecode\C\MyStuff\script.pyc D:\MyOtherStuff\demo.py --> C:\Bytecode\D\MyOtherStuff\demo.pyc sys.bytecodebase = "\Bytecode" C:\MyStuff\script.py --> C:\Bytecode\MyStuff\script.pyc D:\MyOtherStuff\demo.py --> D:\Bytecode\MyOtherStuff\demo.pyc I'm not sure this is entirely *useful* -- YAGNI? -- but it does then provide a good basis for the default case: sys.bytecodebase = "\" C:\MyStuff\script.py --> C:\MyStuff\script.pyc D:\MyOtherStuff\demo.py --> D:\MyOtherStuff\demo.pyc Note also that this would imply a slight tweaking to "during program startup, the value of the PYTHONBYTECODEBASE environment variable is made absolute" to ensure that a drive specifier is not added to PYTHONBYTECODEBASE if it does not already have one. -- James Kew james.kew@btinternet.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev