Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-08 Thread Paul Moore
On 08/01/2008, Christian Heimes [EMAIL PROTECTED] wrote: Paul Moore wrote: What would be used on Windows? It's likely to be of marginal use on Windows, but an appropriate equivalent should be defined. Possibly just replace ~ with %USERPROFILE%. I'd argue against anything under %APPDATA%

Re: [Python-Dev] New Developer

2008-01-08 Thread Paul Moore
On 08/01/2008, Mark Dickinson [EMAIL PROTECTED] wrote: Hello all, I've recently been granted commit privileges; so, following the usual protocol, here's a quick introduction. Welcome, congratulations and thanks for your work so far! Paul. ___

Re: [Python-Dev] New Developer

2008-01-08 Thread Nick Coghlan
Mark Dickinson wrote: Hello all, I've recently been granted commit privileges; so, following the usual protocol, here's a quick introduction. Welcome, and as Paul said, thanks for everything you've done already. Cheers, Nick. P.S. Does this mean Tim now has another person he can talk

Re: [Python-Dev] test_sys failures

2008-01-08 Thread Nick Coghlan
Guido van Rossum wrote: No answers yet, but a clue, and anyone on OSX should now be able to reproduce this (with 2.5, 2.6 or 3.0) as follows: ./python ./Lib/test/test_sys.py | cat That is, the problem happens when stdout is redirected to a pipe (or a file). Redirecting stdout also fails

Re: [Python-Dev] test_sys failures

2008-01-08 Thread Jeroen Ruigrok van der Werven
-On [20080108 12:09], Nick Coghlan ([EMAIL PROTECTED]) wrote: Redirecting stdout also fails for both the trunk and the py3k branch for me on Ubuntu. If I redirected stderr as well then the tests worked again. Given that a pipe/file and the console very likely *do* have different encodings

Re: [Python-Dev] Backport PEP 3129: Class Decorators

2008-01-08 Thread Robin Stocker
Christian Heimes schrieb: PEP 3107 (function annotation), PEP 3104 (nonlocal) and PEP 3132 (extended iterable unpacking: a, *b = 1,2,3) are IMHO other useful feature for 2.6. nonlocal would require a __future__ import. I'm planning to work on PEP 3107 (function annotations) after I have

Re: [Python-Dev] Backport PEP 3129: Class Decorators

2008-01-08 Thread Christian Heimes
Robin Stocker wrote: I'm planning to work on PEP 3107 (function annotations) after I have finished backporting PEP 3102 (keyword-only arguments) (issue1745). Thanks! I've backported class decorators: http://bugs.python.org/issue1759 Could somebody with more knowledge about grammer and ASDL

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-08 Thread Christian Heimes
Paul Moore wrote: Not My Documents, please! That's for documents, not configuration. %USERPROFILE% is actually where most other applications put stuff. The alternative would be %HOMEDRIVE%%HOMEPATH% which is what os.path.expanduser uses. On mys system only one application has put

Re: [Python-Dev] Backport PEP 3129: Class Decorators

2008-01-08 Thread Eli Courtwright
Since we're talking about class decorators, I have a question about function and instancemethod objects. The following code works class Root(object): def index(self): return Hello World! index.exposed = True but this code class Root(object): def index(self): return Hello

Re: [Python-Dev] Backport PEP 3129: Class Decorators

2008-01-08 Thread Eli Courtwright
Christian, Thanks for the example; I'm sorry that I didn't read the docs carefully enough to realize that I could extract the original function and set the attribute on that. - Eli On Jan 8, 2008 11:49 AM, Christian Heimes [EMAIL PROTECTED] wrote: The example should shed some light on the

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-08 Thread Christian Heimes
Paul Moore wrote: Not My Documents, please! That's for documents, not configuration. %USERPROFILE% is actually where most other applications put stuff. The alternative would be %HOMEDRIVE%%HOMEPATH% which is what os.path.expanduser uses.

[Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Christian Heimes
I've attached the first public draft of my first PEP. A working patch against the py3k branch is available at http://bugs.python.org/issue1576 Christian PEP: 369 Title: Lazy importing and post import hooks Version: $Revision$ Last-Modified: $Date$ Author: Christian Heimes

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Neal Becker
Christian Heimes wrote: I've attached the first public draft of my first PEP. A working patch against the py3k branch is available at http://bugs.python.org/issue1576 Christian Note also that mercurial has demandimport http://www.selenic.com/mercurial/wiki/

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Andrew Bennetts
Neal Becker wrote: Christian Heimes wrote: I've attached the first public draft of my first PEP. A working patch against the py3k branch is available at http://bugs.python.org/issue1576 Christian Note also that mercurial has demandimport http://www.selenic.com/mercurial/wiki/ And

Re: [Python-Dev] Extracting variables from string.Template objects

2008-01-08 Thread Aahz
On Fri, Jan 04, 2008, Isaac Morland wrote: On Fri, 4 Jan 2008, Aahz wrote: Also, on a related issue, does it make sense to scan the template string for invalid escape sequences in Template.__init__? For the applications I can imagine of string.Template, I would prefer to get an error upon

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Fred Drake
On Jan 8, 2008, at 7:53 PM, Neal Becker wrote: Note also that mercurial has demandimport http://www.selenic.com/mercurial/wiki/ Let's not forget zope.deferredimport: http://pypi.python.org/pypi/zope.deferredimport -Fred -- Fred Drake fdrake at acm.org

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread glyph
On 01:09 am, [EMAIL PROTECTED] wrote: Neal Becker wrote: Christian Heimes wrote: I've attached the first public draft of my first PEP. A working patch against the py3k branch is available at http://bugs.python.org/issue1576 Christian Note also that mercurial has demandimport

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Christian Heimes
Fred Drake wrote: On Jan 8, 2008, at 7:53 PM, Neal Becker wrote: Note also that mercurial has demandimport http://www.selenic.com/mercurial/wiki/ Let's not forget zope.deferredimport: http://pypi.python.org/pypi/zope.deferredimport I've mentioned zope.deferredimport in my PEP. :)

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Fred Drake
I foolishly wrote: Let's not forget zope.deferredimport: http://pypi.python.org/pypi/zope.deferredimport On Jan 8, 2008, at 11:03 PM, Christian Heimes wrote: I've mentioned zope.deferredimport in my PEP. :) Indeed; that's what I get for scanning the text too quickly. Sorry! The URL I

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Christian Heimes
[EMAIL PROTECTED] wrote: and very recently, I implemented similar functionality myself (though it isn't in use in Twisted yet): http://codebrowse.launchpad.net/~glyph/+junk/pyexport/files I'm going to study your implementation tomorrow. Something that I notice about every other

[Python-Dev] Import by filename with __import__ ?

2008-01-08 Thread Christian Heimes
Today I stumbled about an unknown and undocumented (?) feature. At least it's not documented in our docs. __import__ can import a module by file name: open(/tmp/example.py, w).write(test = 23\n) mod = __import__(/tmp/example) mod module '/tmp/example' from '/tmp/example.py' mod.__name__

Re: [Python-Dev] PEP: Lazy module imports and post import hook

2008-01-08 Thread Phillip J. Eby
At 06:01 AM 1/9/2008 +0100, Christian Heimes wrote: However the PEP covers only the basic infrastructure for lazy imports. For example imp.lazy_import(a.b.c) doesn't put a and a.b in sys.modules. That's probably a mistake. In the early days of peak.util.imports (which is now available as the

Re: [Python-Dev] Import by filename with __import__ ?

2008-01-08 Thread Guido van Rossum
Sounds like a coincidence. Looks like it's using os.path.join(X, name + .py) where X is a member of sys.path, e.g. the initial .. This gives good results for valid module names (which never contain slashes) but in this example, os.path.join() ignores the first component if the second starts with

Re: [Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

2008-01-08 Thread Jeroen Ruigrok van der Werven
-On [20080108 17:07], Christian Heimes ([EMAIL PROTECTED]) wrote: Python's _winreg module and pywin32 expose several functions to get the paths from the registry but I don't think it has a simple function like get_mydocuments(). Careful with the name though. Microsoft Windows Vista did away