views:

598

answers:

10

Short story:

I'm looking for presentations/good articles on switching from Perl to Python.

Longer story:

I'm a programmer / embedded hardware engineer in a hardware design group. A few years ago I've convinced my co-workers to use Perl for scripting (instead of a weird mixture of batch files, Excel, Matlab and TCL). Since then, I myself have switched from Perl to Python and am very happy about the change. I want to somehow convince my coworkers to follow my path, but I need good points to convince them. These can't be heavy programmer voodoo like better reflection facilities (unlike myself, most people here are EE graduates and not programmers).

Any ideas ? Good articles / presentations on the topic ? Perhaps someone has already done it and can share tips.

Note:

This thread is somewhat on the same topic, but not quite fits my requirements.

+6  A: 

What are your own reasons to prefer Python over Perl? What is it that makes you so happy? Are your coworkers unhappy with Perl? If so, what is it about Perl that gives them a hard time and might work better in Python?

The only way to convince them is to show them the possible benefits. Those tend to be very subjective and personal, IMHO.

innaM
I know my reasons :-) Wanted to hear from other people. Besides, I hope for specific pointers - as transition from Perl to Python happens quite a lot, given the recent trends.
Eli Bendersky
IMHO, 'trends are not a reason for switching languages. That way you'll just be switching them all the time ...
ldigas
+3  A: 
Chris Upchurch
And I think it's really due to the contents of the medicine cabinet.
runrig
If you go and change every reference from '`python`' to '`perl`', and '`import antigravity`' to '`use antigravity`', it would still be valid.
Brad Gilbert
Also, cut out half the words, and change half of the letters left into punctuation.
Xiong Chiamiov
+5  A: 

If you can't change a nontechnical manager's mind about how to change from one language to another then you're just not qualified to be suggesting the change or leading the change.

You have to have valid reasons why its better than what already exists - and "I prefer the syntax" or "google uses it" are just not valid reasons financially or even technically.

This is such a massive switch that you need to know in your own mind why it makes sense to do it.

David McLaughlin
+3  A: 

How to convince people Python is better than Perl?

Be more successful in Python than they are in Perl.

When they ask why you're so successful, warn them that they'll have to think outside the box. Be sure they actually want to improve before revealing the secret of your success. [Some people don't want to improve, they want to whine; try not to enable them.]

Until you're more successful, you have nothing to show. The "good points to convince them" are your personal success stories.

Start a private list of "Python to the Rescue" moments. Each Python to the rescue that's an actual win at your actual organization is indisputable.

Each day, you want to look for a tidy, bloggable success story.

S.Lott
Indisputable that Python came to the rescue on that day, at least. But don't be too surprised if the person you show it off to points out an even easier way that Perl (or C or Ruby or...) could have come to the rescue instead.
Dave Sherohman
The trick is not to dispute the merits of alternative solutions. The trick is to be successful. Everything else is just lessons learned from someone who's indisputably ahead of the curve.
S.Lott
It's Perl not perl. You capitalized Python, but didn't have the common decency to capitalize Perl?
Brad Gilbert
@Brad Gilbert: I wouldn't call it a common decency issue. That's ridiculous. I'd call it a spell checker which didn't seem to care either way. However, you're free to blame common decency.
S.Lott
This might work, if you're not only indisputably ahead of the curve, but indisputably ahead of everyone else. Otherwise, you're likely to get "So what, perl can do that too", and rightfully so.
runrig
@runrig: The trick is to be *more* successful than the Perl competitors. Otherwise, it's just a dead heat.
S.Lott
A: 

Ask your co-worker if they can still read their Perl script written few months back or if they can read and understand each other script. One key thing with Python is that is it very readable. Also show them, how they can do all the good stuff in Perl in Python. Show them Python doc. Show them how Python OO is a better integrated to the language compare to Perl.

If you suggest to your manager, mention the part about how it is much easier to maintain. He might mandate that everyone to switch now.

heisen
+12  A: 

There's no benefits to rewriting a ton of code from one similar language to another when both languages have similar capabilities. Perhaps you should focus on writing better perl code. Maybe learn to use perltidy, or buy a copies of Perl Best Practices and Perl Medic, and hand them out to your co-workers. And if you're worried about Perl being not-quite-as-purely OO as Python, use Moose (and I'd counter that Python is lacking in the functional programming department compared to Perl anyway).

In response to the comments below, I'll also say that there's no point to forcing your coworkers to learn and get up to speed on a language with similar capabilities to the one you're already using.

Now, if there's some library or such that your company needs that is available (or far superior) in Python that is not available (or of far lesser quality) in Perl, then go ahead and switch or add another language to the mix.

runrig
Not to mention that, as far as I know, every concept that exists in Python, also exists in Perl. The same can not be said of Perl concepts in Python.
Brad Gilbert
This is understood. I'm aiming at new code, not rewriting existing code.
Eli Bendersky
+7  A: 

I think the first answer you need is the answer to "Why do I want them to switch to Python?", which is one that only you can provide.

From the general tone of your post, I'm inclined to suspect it may mostly just be "Ooh! I found this cool new language and want to share its coolness with everyone!" or, alternately, "Finally something I can use to escape from Perl's clutches..." If that's the case, then why do you care whether other people's personal preferences are the same as yours? If it's just a matter of "we all touch each others' code", then why should your personal preference outweigh everyone else's?

If, OTOH, you believe there are actual technical reasons and significant benefits to be gained by switching, then you need to identify those benefits in concrete terms (actual Python code to demonstrate them is one way to do this, but not the only way) and present them to your coworkers to see whether you can convince them that it would be a good switch to make.

Just be careful so you don't ultimately drive the move from "a weird mixture of batch files, Excel, Matlab and TCL" to a weird mixture of Perl, Python, and whatever other language catches your interest next.

Dave Sherohman
A: 

Here's one of the best: http://steve.yegge.googlepages.com/ancient-languages-perl

Vasil
runrig
...to tell the difference. Then you can just implement whichever most of your developers fall into.
runrig
I think that most Perl-wired people tend to prefer Ruby over Python, since it it somewhat like the syntax of Python with the philosophy of Perl and Smalltalk.
Xiong Chiamiov
+2  A: 

Eric S. Raymond wrote an interesting article/essay on his experience with Python, which were hugely favorable.

On writing working code:

When you're writing working code nearly as fast as you can type and your misstep rate is near zero, it generally means you've achieved mastery of the language. But that didn't make sense, because it was still day one and I was regularly pausing to look up new language and library features!

This was my first clue that, in Python, I was actually dealing with an exceptionally good design. Most languages have so much friction and awkwardness built into their design that you learn most of their feature set long before your misstep rate drops anywhere near zero. Python was the first general-purpose language I'd ever used that reversed this process.

On metaclass hacking:

To say I was astonished would have been positively wallowing in understatement. It's remarkable enough when implementations of simple techniques work exactly as expected the first time; but my first metaclass hack in a new language, six days from a cold standing start? Even if we stipulate that I am a fairly talented hacker, this is an amazing testament to Python's clarity and elegance of design.

There was simply no way I could have pulled off a coup like this in Perl, even with my vastly greater experience level in that language. It was at this point I realized I was probably leaving Perl behind.

Definitely worth a read for anyone who's heard of Raymond, and anyone who's written Python. He has a lot of perl experience (and a lot of coding experience in general), so his glowing review of Python comes with some weight behind it.

Dan Udey
I guess Eric never "could have pulled off a coup" or even could have foreseen something like Class::MOP or Moose.
runrig
Yeah, Eric Raymond's article is good and was among my motivation to finally buckle under and learn Python. Almost as soon as I picked it up, I found that all my Perl skills translated perfectly, and none of my Perl problems. Python is easy to learn: get 'em to write one script and they'll be hooked.
Dan
+4  A: 

Sorry. I am just offended that you treat Perl like basic. and Python like the next step in evolution. Now that I have that off of my chest.

Evaluate the feature(and limitations) difference of the two. Perl has constants, multi-line anonymous functions, and autovivification, but python has better default Object Orientation.

Evaluate the cost/benefit of your team/friends switching. It may be good for your team to have specializations in different languages, or it may be a waste of resources.

Dispel the myths behind Perl and Python.

And of course enjoy whatever language you are using.

J.J.
If anything Python is more like Basic than Perl. Python and Basic try to be easy to read languages.
Brad Gilbert