Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Nick Coghlan
On Wed, May 23, 2012 at 1:58 PM, PJ Eby wrote: > While I see no problem with cleaning up the interface, I'm kind of lost as > to the point of making a get_path callable, vs. just using the iterable > interface you sketched.  Python has iterables, so why add a call to get the > iterable, when iter(

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread PJ Eby
On Tue, May 22, 2012 at 9:58 PM, Nick Coghlan wrote: > If you wanted to do this without changing the sys.meta_path hook API, > you'd have to pass an object to find_module() that did the dynamic > lookup of the value in obj.__iter__. Something like: > >class _LazyPath: >def __init__(se

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Nick Coghlan
On Wed, May 23, 2012 at 10:40 AM, Eric V. Smith wrote: > On 5/22/2012 2:37 PM, Guido van Rossum wrote: >> Okay, I've been convinced that keeping the dynamic path feature is a >> good idea. I am really looking forward to seeing the rationale added >> to the PEP -- that's pretty much the last thing

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread PJ Eby
On Tue, May 22, 2012 at 8:40 PM, Eric V. Smith wrote: > On 5/22/2012 2:37 PM, Guido van Rossum wrote: > > Okay, I've been convinced that keeping the dynamic path feature is a > > good idea. I am really looking forward to seeing the rationale added > > to the PEP -- that's pretty much the last thi

Re: [Python-Dev] [Python-checkins] peps: Added dynamic path computation rationale, specification, and discussion.

2012-05-22 Thread Nick Coghlan
On Wed, May 23, 2012 at 10:35 AM, eric.smith wrote: > +  4. An attempt is made to import an ``encodings`` portion that is > +     found on a path added in step 3. I'd phrase this as something like "import an encoding from an ``encodings`` portion". You don't really import namespace package portio

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Eric V. Smith
On 5/22/2012 2:37 PM, Guido van Rossum wrote: > Okay, I've been convinced that keeping the dynamic path feature is a > good idea. I am really looking forward to seeing the rationale added > to the PEP -- that's pretty much the last thing on my list that made > me hesitate. I'll leave the details of

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Barry Warsaw
Minor nit. On May 22, 2012, at 04:43 PM, PJ Eby wrote: >def declare_namespace(package_name): > parent, dot, tail = package_name.rpartition('.') > attr = '__path__' > if dot: >declare_namespace(parent) > else: >parent, attr = 'sys', 'path' > with importlockconte

Re: [Python-Dev] [Python-checkins] cpython: Issue #14814: addition of the ipaddress module (stage 1 - code and tests)

2012-05-22 Thread Terry Reedy
On 5/22/2012 3:59 PM, Sandro Tosi wrote: Thanks Terry for the review! I've attached a patch to issue14814 addressing your points; but.. On Sun, May 20, 2012 at 7:18 PM, Terry Reedy wrote: +def _get_prefix_length(number1, number2, bits): +"""Get the number of leading bits that are same for

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread PJ Eby
On Tue, May 22, 2012 at 12:31 PM, Eric V. Smith wrote: > On 05/22/2012 11:39 AM, Nick Coghlan wrote: > > Oops, I also meant to say that it's probably worth at least issuing > > ImportWarning if a new portion with an __init__.py gets added - it's > > going to block all future dynamic updates of th

Re: [Python-Dev] [Python-checkins] cpython: Issue #14814: addition of the ipaddress module (stage 1 - code and tests)

2012-05-22 Thread Sandro Tosi
Thanks Terry for the review! I've attached a patch to issue14814 addressing your points; but.. On Sun, May 20, 2012 at 7:18 PM, Terry Reedy wrote: >> +def _get_prefix_length(number1, number2, bits): >> +    """Get the number of leading bits that are same for two numbers. >> + >> +    Args: >> +  

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Guido van Rossum
Okay, I've been convinced that keeping the dynamic path feature is a good idea. I am really looking forward to seeing the rationale added to the PEP -- that's pretty much the last thing on my list that made me hesitate. I'll leave the details of exactly how the parent path is referenced up to the i

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread PJ Eby
On Mon, May 21, 2012 at 8:32 PM, Eric V. Smith wrote: > Any reason to make this the string "sys" or "foo", and not the module > itself? Can the module be replaced in sys.modules? Mostly I'm just curious. > Probably not, but it occurred to me that storing references to modules introduces a refere

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Eric V. Smith
On 05/22/2012 11:39 AM, Nick Coghlan wrote: > On Wed, May 23, 2012 at 12:51 AM, Eric V. Smith wrote: >> That seems like a pretty convincing example to me. >> >> Personally I'm +1 on putting dynamic computation into the PEP, at least >> for top-level namespace packages, and probably for all namespa

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Nick Coghlan
On Wed, May 23, 2012 at 1:39 AM, Nick Coghlan wrote: >     def _recalculate(self): >         # If _parent_path has changed, recalculate _path >         parent_path = tuple(self._parent_path())     # Retrieve and make a > copy >         if parent_path != self._last_parent_path: >             loade

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Nick Coghlan
On Wed, May 23, 2012 at 12:51 AM, Eric V. Smith wrote: > That seems like a pretty convincing example to me. > > Personally I'm +1 on putting dynamic computation into the PEP, at least > for top-level namespace packages, and probably for all namespace packages. Same here, but Guido's right that th

Re: [Python-Dev] PEP 420 - dynamic path computation is missing rationale

2012-05-22 Thread Eric V. Smith
On 05/21/2012 07:25 PM, Nick Coghlan wrote: > As a simple example to back up PJE's explanation, consider: > 1. encodings becomes a namespace package > 2. It sometimes gets imported during interpreter startup to initialise > the standard io streams > 3. An application modifies sys.path after startu

Re: [Python-Dev] [Python-checkins] cpython (2.7): #14804: Remove [] around optional arguments with default values

2012-05-22 Thread Hynek Schlawack
Hi Nick, >> Mostly just mechanical removal of []. In some rare cases I've pulled the >> default value up into the argument list. > Be a little careful with this - "[]" is the right notation when the > function doesn't support keyword arguments. At least one of the > updated signatures is incorrect

Re: [Python-Dev] [Python-checkins] cpython (2.7): #14804: Remove [] around optional arguments with default values

2012-05-22 Thread Nick Coghlan
On Tue, May 22, 2012 at 6:34 PM, hynek.schlawack wrote: > http://hg.python.org/cpython/rev/a3c52115 > changeset:   77102:a3c52115 > branch:      2.7 > parent:      77099:c13066f752a8 > user:        Hynek Schlawack > date:        Tue May 22 10:27:40 2012 +0200 > summary: >  #14804: Remove

Re: [Python-Dev] docs.python.org pointing to Python 3 by default?

2012-05-22 Thread Stefan Scherfke
Am 2012-05-21 um 19:58 schrieb Éric Araujo: > Le 21/05/2012 07:42, Georg Brandl a écrit : >> What about: >> >> * Canonical: >> >> docs.python.org/2/ >> docs.python.org/3/ >> >> for latest versions of 2.x and 3.x >> >> docs.python.org/2.7/ etc. >> >> for latest minor versions >> >> docs.pytho