[Python-Dev] On breaking modules into packages
Ben Finney
ben+python at benfinney.id.au
Wed Nov 3 05:29:18 CET 2010
Antoine Pitrou <solipsis at pitrou.net> writes:
> On Wed, 03 Nov 2010 11:47:55 +1100
> Ben Finney <ben+python at benfinney.id.au> wrote:
> >
> > > If someone wants to depend on some undocumented detail of the
> > > directory layout it's their problem (like people depending on
> > > bytecode and other stuff).
> >
> > I would say that names without a single leading underscore are part
> > of the public API, whether documented or not.
>
> That's not what we are talking about; we are talking about their
> locations. If the official location is the unittest package, then I
> don't see why we should also support undocumented locations just
> because they happen to work.
So long as the names available for import are such that they indicate
whether they're public or implementation-detail (i.e. without a leading
single underscore or with one), I agree that this is distinct from the
issue of locations on the filesystem.
> Otherwise we should also support e.g. "unittest.unlink" if the
> unittest package happens to have "from os import unlink" at its top. I
> don't think it's reasonable.
Hmm. That example does give me pause. I'm trying to think of a simple
way that such imports are excluded from being “public interface”, but
can't immediately think of one.
The distinction is clear in my head, though, for what it's worth :-)
--
\ “I don't accept the currently fashionable assertion that any |
`\ view is automatically as worthy of respect as any equal and |
_o__) opposite view.” —Douglas Adams |
Ben Finney
More information about the Python-Dev
mailing list