[Python-Dev] PEP 402: Simplified Package Layout and Partitioning
Antoine Pitrou
solipsis at pitrou.net
Thu Aug 11 20:12:41 CEST 2011
On Thu, 11 Aug 2011 11:39:52 -0400
Barry Warsaw <barry at python.org> wrote:
> On Aug 11, 2011, at 04:39 PM, Éric Araujo wrote:
>
> >> * XXX what is the __file__ of a "pure virtual" package? ``None``?
> >> Some arbitrary string? The path of the first directory with a
> >> trailing separator? No matter what we put, *some* code is
> >> going to break, but the last choice might allow some code to
> >> accidentally work. Is that good or bad?
> >A pure virtual package having no source file, I think it should have no
> >__file__ at all. I don’t know if that would break more code than using
> >an empty string for example, but it feels righter.
>
> I agree that the empty string is the worst of the choices. no __file__ or
> __file__=None is better.
None should be the answer. It simplifies inspection of module data
(repr(__file__) gives you something recognizable instead of raising)
and makes semantically sense (!) since there is, indeed, no actual file
backing the module.
Regards
Antoine.
More information about the Python-Dev
mailing list