[Gllug] OSS CMSs
Doug Winter
doug at pigeonhold.com
Thu Apr 28 08:36:51 UTC 2005
Dani Pardo wrote:
> I'm using Perl for several years now. I know little Perl, but I think
> the point is about using the right language at the right place. You can
> write clean code in Perl (I do). And you don't have to use Schwartzian
> transform and all those ugly maps() almost never. I prefer to penalize
> performance against clean code.
Having to choose between the two is a sign of a broken language.
In Python, instead of the awful Schwartzian Transform you can do
something like the following interpreter session. I've chosen a
particularly noddy function, but obviously it could be anything:
>>> l = [1,2,3,4,5,6]
>>> def func(x): return -x
...
>>> l.sort(lambda x,y: cmp(func(x), func(y)))
>>> l
[6, 5, 4, 3, 2, 1]
Clean, obvious what it does and quick (the built in sort method is very
efficient).
Generally in python the most elegant code is also the code that has the
best performance. To be fair 'elegant' is in the eye of the beholder to
some extent, and some 'Pythonic' constructions look weird till you are
used to the language.
The Schwartzian Transform reminds me of Duff's Device, and gives me the
same jitters when I see it :)
> BTW: As my CGIs and web applications are growing in complexity, I've
> reached a point that I realized I'm not using the right language for
> such a big applications. So I'm moving to Java (ouch!) and I know I'll
> miss Perl for what it is good at: getting the job done before you get
> fired :)
You've just gone and chose another wrong language. See, we're going to
have the Java Jihad after all. huzzah. :).
doug.
--
6973E2CF: 2C95 66AD 1596 37D2 41FC 609F 76C0 A4EC 6973 E2CF
http://adju.st/
information wants to be noise
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list