Thinking Pythonically (was Re: gah! I hate the new string syntax)

Donn Cave donn at oz.net
Sat Mar 3 00:57:41 EST 2001


Quoth Mark Pilgrim <f8dy at diveintopython.org>:
...
| My original point, in case it got lost in the details, was that I like list
| comprehensions because they force me to think Pythonically.  By that I mean
| thinking in terms of the things that Python is good at, like lists and
| dictionaries.  These are rich data structures with lots of built-in
| capabilities, and if I don't use them, I may as well go back to programming
| in Powerbuilder: writing WHILE loops to do progressive searches through
| strings when I really want something like the above example, using SELECT
| CASE statements for jump tables when all I really want is a dictionary of
| functions, and so forth.

Ah.  You know, not only am I a grizzled, hide-bound veteran of old
python versions beyond reckoning, I'm a UNIX programmer.

I have no idea what it's like to use Visual Basic, I have never
even heard of Powerbuilder.  Like many of my gnarly old brethren,
I fooled around with Scheme dialects, Tcl and whatever came along,
until eventually I think it was Ken Manheimer was kind enough to
personally mail me a clue about Python, but the big competition
in our world was and still is Perl.  Most of us have been there,
and when we ask ourselves what Python is about, Perl is a huge
part of the background.

If you haven't already, you must learn about Perl.  You don't
need to write programs, but along with some reading about the
language you want to see what happens when people actually write
Perl to do stuff, not for publication.  This is a language that
has the lists and the dictionaries and lots more syntactical
features that save you a bundle of typing - Python is tediously
verbose by comparison.  Many people love Perl.  You may find that
you do, too, there's no reason to expect otherwise.  But it's
important to recognize that there is a huge crowd of people who
swim upstream to use Python instead, and it's not just because
we have to be different, it's not because we want to use Zope
or our boss twisted our arm to write in Python.  It's certainly
not because Python is more powerful, in the sense you have been
talking about.  I'm beating around the bush a little, because
I don't know how to talk about it directly in a way that really
does justice to it, but I think if you get it, you'll find it
more interesting than rich feature sets.  Or maybe not, I don't
know, I guess it's not for everyone, but for myself, I want to
challenge your notion of what it is to think Pythonically.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list