A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-July/112383.html below:

"Simplified Package Layout and Partitioning"

[Python-Dev] Draft PEP: "Simplified Package Layout and Partitioning" [Python-Dev] Draft PEP: "Simplified Package Layout and Partitioning"Terry Reedy tjreedy at udel.edu
Wed Jul 20 21:51:39 CEST 2011
On 7/20/2011 1:04 PM, P.J. Eby wrote:

>> This part worries me slightly. Imagine a program as such:
>>
>> datagen.py
>> json/foo.js
>> json/bar.js
>>
>> datagen.py uses the files in json/ to generate sample data for a
>> database. In datagen.py is the following code:
>>
>> try:
>> import json
>> except ImportError:
>> import simplejson as json

While reading the PEP, I worried about this standard usage too but 
missed the scenario you imagined. Good catch.

> A possible mitigation would be to require that get_subpath() only return
> a directory name if that directory in fact contains importable modules
> somewhere. This is actually discussed a bit later as an open issue under
> "Implementation Notes", indicating that iter_modules() has this issue as
> well.

If one actually wants to create a bare-as-possible empty module, one can 
do that now either with a directory containing an empty __init__.py or, 
even cleaner, imp.new_module. So there is no need for the new mechanism 
to ever duplicate either ;-). So +1 on improving back-compatibility.

-- 
Terry Jan Reedy

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4