Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-14 Thread Brett Cannon
On Sun, Oct 13, 2013 at 3:08 PM, Victor Stinner wrote: > Le 13 oct. 2013 10:19, "Stefan Behnel" a écrit : > > > I agree. I find it much easier to read a plain and obvious > > > > try: > >from _cmodule import * > > except ImportError: > >from _pymodule import * > > > > in a

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-13 Thread Victor Stinner
Le 13 oct. 2013 10:19, "Stefan Behnel" a écrit : > I agree. I find it much easier to read a plain and obvious > > try: >from _cmodule import * > except ImportError: >from _pymodule import * > > in a facade module ... I miss maybe something. I don't understand why you would

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-13 Thread Stefan Behnel
Oscar Benjamin, 13.10.2013 18:35: > CPython preferentially imports extension modules over .py modules with > the same name. This is what happens when you use Cython in "pure" > mode: You have a pure mod.py file and an "augmenting" mod.pxd that > contains the annotations relevant to Cython. The resu

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-13 Thread Oscar Benjamin
On 12 October 2013 17:55, Christian Heimes wrote: > Am 12.10.2013 17:37, schrieb Nick Coghlan: >> I think the default recommendation in PEP 399 still makes sense - 2 >> modules are easy to manage than three and the idiom allows for easy >> partial replacement. > > We could ues yet another approach

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-13 Thread Stefan Krah
Stefan Behnel wrote: > in a facade module than > > # lots and lots > # of unused > # Python code > # here ... > > # ... and then this, well hidden at the end, telling > # me that I just waded through the entirely wrong code: > > try: >from _cmodule import * >

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-13 Thread Stefan Behnel
Antoine Pitrou, 12.10.2013 23:40: > On Sat, 12 Oct 2013 23:35:23 +0200 > Christian Heimes wrote: >> A directory with pure Python modules is less cumbersome than a couple >> of facade modules or intended code in try/except ImportError blocks. > > I don't find it cumbersome to be explicit here. It m

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Antoine Pitrou
On Sat, 12 Oct 2013 23:35:23 +0200 Christian Heimes wrote: > Am 12.10.2013 19:02, schrieb Antoine Pitrou: > > If you grow sys.path, imports get slower. > > (IMHO it also makes the source tree more cumbersome to navigate) > > It shouldn't slow down successful imports. The module finder stops at >

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Christian Heimes
Am 12.10.2013 19:02, schrieb Antoine Pitrou: > If you grow sys.path, imports get slower. > (IMHO it also makes the source tree more cumbersome to navigate) It shouldn't slow down successful imports. The module finder stops at first hit. A directory with pure Python modules is less cumbersome than

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Stefan Krah
Stefan Behnel wrote: > FWIW, I think this definitely makes sense in cases where the C > implementation is essentially a complete replacement of the original > module, such as in this case. I even sometimes suggest compiling Python > modules with Cython if the import time matters. > > For "normal"

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Antoine Pitrou
On Sat, 12 Oct 2013 18:55:42 +0200 Christian Heimes wrote: > Am 12.10.2013 17:37, schrieb Nick Coghlan: > > I think the default recommendation in PEP 399 still makes sense - 2 > > modules are easy to manage than three and the idiom allows for easy > > partial replacement. > > We could ues yet ano

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Christian Heimes
Am 12.10.2013 17:37, schrieb Nick Coghlan: > I think the default recommendation in PEP 399 still makes sense - 2 > modules are easy to manage than three and the idiom allows for easy > partial replacement. We could ues yet another approach and put the pure Python implementation of modules into ano

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Nick Coghlan
On 13 Oct 2013 00:47, "R. David Murray" wrote: > > On Sat, 12 Oct 2013 16:04:23 +0200, Stefan Behnel wrote: > > Stefan Krah, 12.10.2013 15:41: > > > Nick Coghlan wrote: > > >> On 12 Oct 2013 05:49, "Eric Snow" wrote: > > >>> On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote: > > Antoine Pit

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread R. David Murray
On Sat, 12 Oct 2013 16:04:23 +0200, Stefan Behnel wrote: > Stefan Krah, 12.10.2013 15:41: > > Nick Coghlan wrote: > >> On 12 Oct 2013 05:49, "Eric Snow" wrote: > >>> On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote: > Antoine Pitrou wrote: > > Just create a _pydecimal module (like _pyio

Re: [Python-Dev] Change PEP 399 import recommendation

2013-10-12 Thread Stefan Behnel
Stefan Krah, 12.10.2013 15:41: > Nick Coghlan wrote: >> On 12 Oct 2013 05:49, "Eric Snow" wrote: >>> On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote: Antoine Pitrou wrote: > Just create a _pydecimal module (like _pyio). That's very fast indeed. There's one minor problem: For b

Re: [Python-Dev] Change PEP 399 import recommendation (was: C extension import time)

2013-10-12 Thread Stefan Krah
Nick Coghlan wrote: > On 12 Oct 2013 05:49, "Eric Snow" wrote: > > > > On Fri, Oct 11, 2013 at 1:41 PM, Stefan Krah wrote: > > > Antoine Pitrou wrote: > > >> Just create a _pydecimal module (like _pyio). > > > > > > That's very fast indeed. There's one minor problem: For backwards > compatibili