Is it pythonic to have my own util library?

Jack Diederich jack at
Mon Jan 20 00:37:35 CET 2003

On Sun, Jan 19, 2003 at 10:47:31PM +0000, Paul Johnston wrote:
> Hi,
> One thing I've noticed about my programming style is that whatever
> language I use, I usually end up having a "paj's utility library" that
> makes some common tasks one-liners.
> Python's neat concise style takes away the need for a lot of them - for
> example open(filename).read() is just perfect. But still I've got quite
> a few functions - mostly for database access and template files. I've
> attached the one I'm using for at the moment and would be interested in
> comments.
> Is this a good idea?
> Is there some high-level database API I haven't found?
> Are there better packages for doing templates?
> I'd be interested in comments on the readability of

[I wouldn't have included it as an attachment...]

Any language I've ever used seriously ends up with a snipptet
library that perform tasks common to one application.  The nice
thing about python is that it is young enough that when enough
people have a common snippet in those disperse libraries it ends up 
in the common distro.

In short, don't sweat it.  The best thing you can do is document it
for posterity and your own sanity and keep knocking out code.  oh,
and name it sanely.  Once it grows over a couple dozen functions break
it out into sub-libs libString, libList, libDescriptive.  I once worked
at an unnamed company that had libs named molimutil1.c molimlib2.c ..
with a high N each one with 5k lines of code.  Even grep can't help
you then.


ps, the lib names were un-anonymized to indite the guilty/make an inside joke.

More information about the Python-list mailing list