OT: Crazy Programming

Andrew Dalke dalke at dalkescientific.com
Mon May 13 03:33:54 EDT 2002


Chris:
> In the end, the best idioms become commonplace, but they become
> commonplace not just because they're obvious, though that might be
> the case, but because the alternatives have been explored and the
> accepted approach has genuine benefits.

This requires everyone who codes in Perl to learn these idioms, and
in practice this doesn't happen.  My Perl for the most part felt like
C because I expected the people who maintained my code to be primarily
C developers, so I deliberately excluded more Perlish idioms.

Since Perl people like the analogy to human languages, it's like me
saying I drink 'soda's while people in the Midwest drink 'pop'.  (These
are regional dialects in the US.  Elsewhere uses other terms, like
'cooldrink')  There isn't a genuine benefit of one over the other, so
other effects dominate, and leaves me confused when I don't know the
local dialect.


>While I enjoy Python - and I do... it opned up the world of OO
>programming for me - I think there's almost a danger in things being too
>obvious.  Creativity can be a messy business, but ultimately it leads to
>better places.

You argue, or at least imply

  Perl allows many alternatives
  creativity is good
  creativity can be messy
  Python almost makes things 'too obvious' (suggesting perhaps adding
     more alternatives)

I used to know a lot about the different ways to do things in Perl.
As far as I can tell, the creativity in its alternatives is the
creativity to choose different ways to implement a solution, but the
style of the solution doesn't change from what's possible in Python,
besides some minor differences in small problems where one language
has a built-in language feature which gives it an advantage over the
other.

By way of comparison, in elementary school I had a four-color pen.
I recall coming up with a scheme of which color should be used for
which topic.  I don't recall any details so I'll make something up.
For example, in a vocabulary assignment I might use black for the
word and blue for the definition.

I spent time to decide how to express that creativity, but in the
end it didn't make any difference, since that wasn't part of the
assignment.

In other words, having a lot of alternatives doesn't have to make
things better and can make things worse because of the extra thought
needed to figure out which is proper.

That's not to say that Python isn't colorful or has its own set of
alternatives.  But the Python way isn't "There's More Than One Way
To Do It" nor the opposite of "There's one and only one way to do it"
but instead is "There should be one -- and preferably only one --
obvious way to do it."  Those "preferably" and "obvious" qualifiers
are important.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list