[Import-SIG] PEP 420: Implicit Namespace Packages

martin at v.loewis.de martin at v.loewis.de
Fri May 4 02:11:02 CEST 2012

Zitat von Barry Warsaw <barry at python.org>:

> On May 03, 2012, at 10:48 AM, Brett Cannon wrote:
>> So, to the people not wanting to set __file__, that  (probably) won't fly
>> because it has been documented for years that built-in modules are the only
>> things that don't define __file__.
> Okay, but *why* is this the rule, other than that PEP 302 says it?

I think it predates PEP 302 by a decade or so. You might also ask why
the keyword is "def", and not "define" (other than that the Grammar says
so). It's a natural thing, also: If the module comes from the file system,
it has an __file__ attribute, else it's built-in.


More information about the Import-SIG mailing list