Package organization
Terry Hancock
hancock at anansispaceworks.com
Wed Jun 22 18:02:01 EDT 2005
On Wednesday 22 June 2005 01:42 pm, Thomas Lotze wrote:
> Assume I have a package called PDF. Should the classes then be called
> simply File and Objects, as it is clear what they do as they are
> imported from PDF? Or should they be called PDFFile and PDFObjects, as
> the names would be too undescriptive otherwise?
If you import PDF instead of importing from PDF, you will get that anyway:
import PDF
then you can refer to:
PDF.File
and
PDF.Object
the only downside to this is that you are using a "." operator each time,
which is a (TINY) performance hit. In tightly optimized loops, some folks
recommend avoiding this. But then, so what?
PDE_File = PDF.File
and the problem goes away.
This always seems cleaner to me than:
PDF.PDFFile etc, which drives me crazy to read. Useless repetition just
gets annoying.
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Python-list
mailing list