how to reuse class deinitions?

Scott David Daniels scott.daniels at
Mon Oct 2 00:48:48 CEST 2006

sam wrote:
> pretty straightforward question here, i think. i'm experimenting with
> classes and have written a File class that looks like it's worth
> keeping for future use. however, i cannot work out where to put it for
> this purpose or how to get it in.

What I do:

For each new major version of python, in .../site-packages I make a
directory "sdd" (my initials).  In it I put an empty file named
"".  When I have things I want to reuse, I put them in
files named things like ".../site-packages/sdd/", and
I get use of them in python programs like:

     from sdd.goodidea import File
     <code that uses File>

or (actually my current style):
     from sdd import goodidea
     <code that uses goodidea.File>

--Scott David Daniels
scott.daniels at

More information about the Python-list mailing list