tundra at tundraware.com
Tue Feb 19 21:07:10 UTC 2008
Gary Kline wrote:
> On Tuesday 19 February 2008 08:16:57 Chad Perrin wrote:
>> On Tue, Feb 19, 2008 at 09:20:47AM -0500, William Bulley wrote:
>>> According to Tim Daneliuk <tundra at tundraware.com>:
>>>> Before you go down this road too far, you should take a look at Python
>>>> as an implementation language. If what you're doing involves text and
>>>> string manipulation, Python is loaded with good modules that will make
>>>> your task a snap. Having coded extensively in many assemblers, C,
>>>> BASIC, ... I now find myself reaching exclusively for Python when
>>>> writing applications and utilities unless the task at hand must have
>>>> the performance of native C. Try it ... you'll be shocked how fast
>>>> your program comes together.
>>> Might the same not be said for Perl?
>> Yes . . . and Ruby. I prefer both over Python, for different reasons,
> Gotta laugh at most of this considering that I understand that we tend to
> favor what we're most familiar with. I've been lazing along for several
> years since I've gone back to school--sort of. During my last lifetime I
> was trapped into learning perl and forced myself to get into C++ because
> much of my work required these languages.
> Can you guys, or anybody else, point me to some comparison sites for python
> and ruby? I just found one abandoned freeware suite in ruby that may be just
> what I'm trying to do. The deal is: do I want to invest months (from 2 to 3)
> in learning another language/ or port from ruby to C? or take the Java
> functions and re-write or translate them to C?
> Still, first thing is to get the algorithm down and tested.
Basically, you'll discover that Python and Ruby do many of the same things
in similar, but different ways. The OO purists like Ruby because it tends
(as I understand it) to be more academically pure as an OO language.
Many web apps folk also like Ruby because of the well-received Ruby-On-Rails
OTOH, Python is highly regarded because of its very rich library support,
excellent cross-platform consistency, and ability to switch programming
paradigms in mid-program. The last bears a bit of explanation. Most
languages have you programing in one paradigm: imperative/procedural
(Algol-derived), functional (Haskell), list processing (LISP),
Object Oriented (C++, Java), etc... But here in the Real World, a
single paradigm is not always a good idea. (With slight modesty, may
I suggest a read of something I did a while back on this subject:
One of Python's great virtues is that it lets you "switch gears"
paradigmatically in the middle of a program to use the model that best
suits your problem. So for, instance, you can be doing OO programming,
but quickly switch to procedural programming when the code needs to do
DBMS access - a place where there has always been an OO/DBMS
"impedance mismatch" in the past.
As to the learning curve. If you are an experienced programmer in any
decent language (C, BASIC, Java, Perl, Ruby, ...), you can learn the
essence of Python in an afternoon, not weeks or months. As I said,
I've been doing this for a while. Moreover, my graduate work was in
languages and automata. This means I am a language dork. In several
decades of fiddling around with languages, I have *never* seen one as
elegant, expressive, maintainable, and efficient for the programmer as
Python. No, it's not as fast as native C, but unless you're doing real
time or systems programming, with good programming style and design
modern hardware doesn't require you to write applications in C. In any
case, you can profile Python code, figure out the small portions of it
that are slow and replace them with callouts to C functions. In short,
and IMHO, Python is an (almost) perfect applications/utility
programming language. And I'm not alone in thinking so. The Python
community is full of people who were/are C/C++, Perl, Java, LISP, ...
experts who wouldn't go back to their old languages under any
circumstance - Python is that good.
Having said this, there is, and always will be a place for many kinds
of programming languages because there are many kinds of problems and
even more kinds of people. Again, with slight modesty, may I suggest
Tim Daneliuk tundra at tundraware.com
PGP Key: http://www.tundraware.com/PGP/
More information about the freebsd-questions