by ChuckMcM · 12y ago · 0 comments
At the end of the day I find I prefer perl for quick things, and Python for multithreaded things.
Contrast with Python's philosophy: https://wiki.python.org/moin/TOOWTDI
Python's philosophy may be limiting for some people, but I'd rather have code that I have a decent chance of reading and understanding the run-time behavior of than a language that encourages extreme personalization.
The whole parsing thing doesn't help either: http://www.jeffreykegler.com/Home/perl-and-undecidability
And secondly its extremely rare that you will run into some obscure feature which indulges in the whole parsing thing you mentioned.
For me...
* perl is a bit more intuitive, even though I've done about as much python as perl at this point.
* It's the best language for dealing with regular expressions in my view. You don't have to create a regex object and muck about with all of that.
* You can create lambdas/closures with fewer restrictions than Python (this is a big one)
* CPAN is pretty good. Python comes with a lot of libraries, so this isn't as much of an edge as it used to be.
* It is more widely available on other servers, even older ones, which is important for me because I'll sometimes have to do work on a machine without Python already installed. I can work with older perl and I've never been on a machine without it installed.
* The whitespace issue really is annoying to me. With braces you can move stuff in and out of conditionals, etc, easier than with Python, even with editor support.
As for readability, I try to write reasonably well, even if in a hurry. I know the language and its syntax. I understand the purpose and meaning of the sigils, so it doesn't look like noise to me anymore than reasonably written python. In Python, for instance, I've seen list comprehensions that are pretty frustrating to puzzle through. Perl with strict and warnings and written without a specific aim to be clever isn't hard to read.
When I was at Google I started using Python to create a CMS of sorts for my toy website (robotics.mcmanis.com) which got to the point of being able to push some stuff but more complex stuff was a pain. So it sat there. Then rebuilding that with perl and the template toolkit it was a bit easier and I was much happier with the result. I still don't have a lot of time for it (like none for the last few months) but I got the framework for putting up a new "article" down to a pretty smooth process and managing all the internal links worked well.
Perhaps it is that I programmed in C for so long that my synapses are more attuned to reading code with braces. But I find I can look at perl and intuit its function much more quickly than I can do the same for Python.
I assume you mean named captures?
C:\>perl -E "'abc1234asf' =~ /(?<one>\d+)/; say $+{one};"
1234
> template toolkitPlease try Text::Xslate. :)
To the extent that I can simplify steps with Xslate we'll see. It still takes too long to go from 'thought' to 'page' (and my 'schematic description' -> SVG (or PNG) schematic work is still incomplete)
Python is in that respect essentially the same as Perl with Coro built-in. ( https://metacpan.org/pod/Coro )
That said[1], I probably feel the same way about the use of 'because' in informal speech. Which was recently upgraded to include the form "because <noun>." I don't find that a particularly compelling upgrade.
[1] Another habitual favorite of mine.
---
I think what gets me about leading with "So" (more so in spoken converstaion) is that it makes the speaker sound like they're constantly, and consciously, having to reframe things in a form that the poor dummy they're speaking to will understand.
Politicians do it a lot when answering questions.
I also recognise that it's more innocently used when telling a story.
http://chronicle.com/blogs/linguafranca/2011/12/02/so-it-tur...
(Predictably the Chronicle article has a bunch of comedy geniuses using it as a comment!)