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

2013年10月13日 01:20:37 -0700

Antoine Pitrou, 12.10.2013 23:40:
> On 2013年10月12日 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 makes it obvious
> what happens. It also makes it extra easy to import the pure Python if
> desired (for example for unit tests, or for benchmarking).
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 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 *
 except ImportError:
 pass
As I said, that's different for the case where the C module replaces only a
somewhat small part of the Python code, but for the case of an (almost)
complete replacement, I would like to see the 3-files approach as the One
Way To Do It.
Stefan
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to