[NBLUG/talk] Perl vs other scripting methods

Chris Palmer chris at eff.org
Tue May 9 17:47:59 PDT 2006


matt writes:

> > So tell me what Python is good at.
> 
> I would say simply that Python is an easy but powerful language.
> Python is good at accomplishing real programs in minimal amounts of
> time, and has bindings to almost all major GUI toolkits. Python was
> created to be one of the most intuitive languages out there, making it
> more human-readable and having less unnecessary syntax than other
> languages (semicolons and braces that are at this point in
> technologically useless).

Let me expand on words like "intuitive" and "elegant".  In the
computer-human interface (CHI) world, there are two interesting terms of
art: *monotony* and *modelessness*.  Monotony is when there is only one
way to perform a task; only one "action" or "gesture" does a given task.
Modelessness is when an interface has no modes; that is, every action or
gesture always does the same thing.  (Think of vi and emacs, where
gestures -- keystrokes -- change their meaning depending on what mode
you're in.)

Monotony and modelessness are worthy user interface goals, although a
truly monotonous interface might be annoying, especially if the gestures
are expensive.  (For example, every serious GUI app has keyboard
shortcuts!  Mouse gestures are expensive.)  But one reason I like Mutt
so much is that it is pretty monotonous.  (It's certainly not modeless,
though!)

A modeless, monotonous interface is easy to learn and "read", because
there is less to learn and read (I'm using "read" in a general sense
here).

A programming language is a user interface.

Python is more monotonous and more modeless than many other programming
languages, especially moreso than Perl.  One of Perl's mottos --
"There's more than one way to do it!" -- is a celebration of its
non-monotony.  Perl haters (I still love Perl, myself; but I've figured
out that its applicability is very constrained) gripe about its
non-monotony, although not in those terms ("why are there so many ways
to do the same thing?!").

If you're wondering what a programming language analog of "mode" might
be, consider the $/ variable in Perl.  (Being Perl, it of course has
more than one name, an example of non-monotony --
$INPUT_RECORD_SEPARATOR).  If you change this value, the meaning of a
"gesture" like

    @records = <$filehandle>;

changes drastically.  Another example is "scalar context" vs. "list
context" -- those "contexts" are modes.  The meaning of a function call
will change depending on the context in which it was called.

Python of course has other usability improvements beyond
closer-to-monotony and modelessness, such as pervasive use of namespaces
and less "noisy" syntax (although that tends to devolve into a matter of
taste pretty quickly).

As far as what is Python good for, it's pretty much in the same class as
Ruby and Perl: very high-level, object-functional, portable, virtual
machine, garbage-collected, and with huge standard libraries (GUI,
networking, text mangling, POSIX, et c.).  In application terms, that
means all three languages are well-suited to web apps, rapid
prototyping, scripting, controlling other software, AI, research of
various types, ...


-- 
https://www.eff.org/about/staff/#chris_palmer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://nblug.org/pipermail/talk/attachments/20060509/72cbfd19/attachment.pgp


More information about the talk mailing list