[vox-tech] python: slicing extensions from file names

Micah J. Cowan vox-tech@lists.lugod.org
Tue, 29 Jul 2003 16:57:35 -0700


On Tue, Jul 29, 2003 at 02:31:57PM -0700, Troy Arnold wrote:
> On Tue, Jul 29, 2003 at 02:05:12PM -0700, Micah J. Cowan wrote:
> > On Tue, Jul 29, 2003 at 01:24:38PM -0700, David Hummel wrote:
> > > On Tue, Jul 29, 2003 at 12:37:27PM -0700, Norm Matloff wrote:
> > > > 
> > > > By the way, I can't resist urging all you Perl users out there to
> > > > switch to Python. :-)
> > > 
> > > The advantages of Python are clear, but I'd say switching isn't
> > > necessary.  Better to learn both and use the language that best fits the
> > > task.
> > 
> > Very heartily agreed. Both Perl and Python have very strong traits,
> > and the overlap (IMHO, anyway) between those traits is fairly small.
> 
> I agree strongly with that as well (choose the tool according to the
> job).  In principle only in this case because I don't know any Python.

Well, for one thing, these guys are putting it to good use as a
scripting platform for an RPG they're building:

  http://adonthell.linuxgames.com/

And actually, pygame.org is a great use of Python for game creation,
too.

Obviously, if cycles are absolutely *crucial*, you'd be better off
with C or C++, since with Python or Perl you'll be wasting cycles
interpreting bytecode-compiled programs. But Python code is by far the
most extremely readable code I've come across, which makes it
particularly good to write code for educational purposes (not to be
construed as saying Python is an "educational" programming language in
the same way that Pascal is...).

Actually, most of the time I personally prefer C or C++. But if I want
a higher-level language that allows me to finish faster in exchange
for less efficient programs, less direct control over what's
happening, and the requirement that an implementation be present on
the end-user's machine, then assuming I knew Python quite as well as I
know Perl, I would usually use Perl for doing stuff that had any kind
of major text processing, and Python especially for GUI-oriented
things.

Depends on the text processing, though: I find that
character-by-character access of a text string is somewhat less
painful in Python compared to Perl. It always seemed kind of strange
to me that there wasn't a straightforward C-array-style access to
strings, or something similar, in Perl.

Pet peeve about Python is probably the braindead scoping
rules. Lexical scopes are not nested: when you enter a block within a
block, the outer block is completely and utterly obscured.

-Micah