[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?



On Sun, Feb 15, 2004 at 06:12:24PM +1000, Andrew Pollock wrote:
> whether to do it in Perl (which I know) or Python (which I do not, but
> wouldn't mind a good excuse to learn).

I have just been looking at languages over the weekend myself.

My opinion of Perl is that it is probably the best choice for small
tasks, single-task things that are parser-heavy, etc.  It scales poorly,
though, to the point where I would say that code maintainability has an
exponential decay when plotted against code size :-)

I use Python a lot.  There are some Debian-specific Python classes out
there (specifically regarding interfaces to apt and debconf), though (at
least in the case of apt) they are poorly documented.

Perl and Python both have quite sizable libraries of add-on modules.
When I was looking at places to go from Perl 3 or 4 years ago, that is
the reason I chose Python instead of another language like Ruby.
Python's *standard* library is more featureful than the entire set of
add-on modules for some languages, yet is quite lean.

Take a look at www.python.org/doc/current, then hit the Global Module
Index to see what is available.  There are yet more modules out there
that are not part of the standard; grep-dctrl for python in Debian will
be instructive.  www.twistedmatrix.com has one of the most interesting.

Despite the fact that I think other languages like Haskell (and perhaps
Ruby) are still more clean than Python (which is already quite nice),
the benefit of not having to reinvent the wheel is still a huge win for
Python.

Perl and Java both have large libraries as well -- perhaps even larger
than Python.  However, I have only once found Python to be lacking in
some feature I wanted -- it's builtin imaplib totally sucks -- and the
wins of more rapid development and easier maintainability keep me in
Python.  (Plus Twisted has a much nicer IMAP implementation <g>)

> Also, does anyone know if Python has a database abstraction layer (like
> PHP's ADODB)?

Yes, it is known as DB-API 2.0.  Read about it at
http://www.python.org/topics/database/.

It reminds me a lot of Perl's DBI.  It does not have quite the power of
JDBC, and has one bug I consider to be severe (failing to completely
standardize replacable arguments in repeated queries), but overall is
nice.

-- John



Reply to: