Package organization

Thomas Lotze thomas at thomas-lotze.de
Wed Jun 22 21:52:14 CEST 2005


F. Petitjean wrote:

> As you whish :-)

Damn freedom of choice *g

> if in the package ie in the __init__.py (not the best idea) from PDF
> import File as PDFFile  # always possible

Technically, this is clear - however I don't like the idea of giving the
same thing different names, especially if there's a chance that other
people get to look at and try to understand the code...

Using short names being unique by virtue of the subpackage hierarchy
internally and leaving it to the user (which might even be another
subpackage of the library) to import it as something more descriptive in
his context is probably the easiest, cleanest and least obtrusive thing,
as I think about it.

> Have you installed the reportlab package ? It is full of from ... import
> ..  and it generates PDF.

I do know ReportLab. IIRC, last time I looked, it didn't simply expose an
API that models and operates on a PDF document's structures, but was
designed to produce PDF files with a certain kind of content. It didn't
seem to be of much easy use for anything wildly different from that.

-- 
Thomas




More information about the Python-list mailing list