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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to