Phillip J. Eby wrote:
>> I assume you want
>>
>> import x.y
>>
>> to fail if y is an empty directory (or non-empty, but without .py
>> files). I don't see a value in implementing such a restriction.
> 
> No, I'm saying that tools which are looking for packages and asking, "Is
> this directory a package?" should decide "no" in the case where it
> contains no modules.

Ah. Tools are of course free to do that. It would slightly deviate
from Python's implementation of import, but the difference wouldn't
matter for all practical purposes.

So from a language lawyers' point of view, I would specify:

"A sub-package is a sub-directory of a package that contains at least
one module file. Python implementations MAY accept sub-directories
as sub-packages even if they contain no module files as package, instead
of raising ImportError on attempts to import that sub-package."

(a module file, in that context, would be a file file which matches
imp.get_suffixes(), in case that isn't clear)

Regards,
Martin
_______________________________________________
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