views:

602

answers:

7

I'm all for learning and continual improving one’s self, and I believe you should have as many tools as possible in your toolbox. However, I was wondering if it was worth it learning Python, since I already know a couple of dynamic interpreted languages, including Perl. My background is mostly C/C++/Java/C#, but I’ve programmed in Perl quite a bit over the years.

I recently read Dive Into Python, as well as the tutorial for the Django framework for a new project where Python was suggested. However, I kept finding myself thinking that I can still accomplish much of the same stuff with Perl, so I’m not sure when I would choose a Python approach over one that I’m already familiar with. This is by no means meant to start any kind of language war, and I do recognize that language choice is quite subjective. I just wondering when one would make such a choice.

A: 

I find Perl useful for small programs (up to a screenful) that munge data in more complex way than a simple pipeline. But when I get to bigger programs, with more people involved, Python 'scales' up better due to cleaner syntax for classes.

florin
Try Moose/MooseX::Declare for Perl OO programming.
Alexandr Ciornii
I find Python useful for small programs (up to a screenful) that do object orientation. But when I get to bigger problems, with more people involved, Perl 'scales' up better due to cleaner (that is to say it has some), syntax for multi-line lambdas.
MkV
+10  A: 

Yes, it's worth learning Python, or at least giving it a try. Learning a new language is practically never a bad thing.

And I say this as someone who loves Perl, has code on CPAN, and has written (and successfully maintained over multiple years) moderately-large applications in Perl. I also personally loathe working in Python, because the language just doesn't click for me.

But that's all just me. Maybe you'll try Python and love it. Maybe you'll try Python and hate it. But you'll never know until you try it.

Dave Sherohman
"Learning a new language is practically never a bad thing." ...unless it's COBOL
Longpoke
unless it's COBOL... Good one!
Garett
Python is similar to Perl in many ways, better to learn a language like Prolog, Scala or Forth, that does things differently.
MkV
+15  A: 

I was in the same situation - a fluent Perl programmer, wondering about learning Python 'as another tool'. I actually abortively tried to learn Python several times. Each time I gave up because as you say, everything I wanted to do, I could already do in Perl.

It wasn't until my work required me to write in Python that I had enough of a requirement to do so. My opinion is that unless you have a strong requirement, such as work or career motives, a need for a key Python library (for example, Pygame), or you really want to use a Python-specific framework like Django, or extend an existing Python project (Civilization IV was a motivator for me), you will find it hard to stick with it, because the two languages cover a lot of similar ground.

If you do go down the Python route, there is a related question which may be helpful to you: Python for a Perl programmer.

I personally think that the argument that Python is 'cleaner' than Perl, more extensible for large projects etc., is completely bogus. But then, as an ex-Perl programmer, I would say that, wouldn't I? ;) Try them both, and make up your own mind.

ire_and_curses
Thanks for the Python for a Perl programmer link. It's great!
Garett
I agree on your argument about libraries, but I thought Pygame was just Python's name for SDL. And perl has SDL: http://sdl.perl.org/
runrig
@runrig: Thanks for the link. I think you're right - they look very similar. I'd not heard of the Perl SDL project before.
ire_and_curses
A: 

It is definitely worth it.

Learning should take maximum few days if you focus.

I learned Python in second iteration, something lot of my colleagues and other people experienced. I went trough Python tutorial and Dive into Python like you said. Thinking how to accomplish those examples in other languages gives you clear answer why Python is so hot and popular these days.

Good luck.

Irfan Mulic
+9  A: 

Lots of good answers, already. I'd just add that given the fact that you already know Perl, the C family, and Java, you may benefit more from learning something more different than Python.

The obvious next thing to learn is some sort of functional language. Take your pick of Scheme, Lisp, Haskell, O'Caml, and maybe Erlang or Scala.

From a more practical standpoint, if you don't know Javascript, that's an obvious next target. If you want to build good modern webapps, you simply must know JS.

Dave Rolsky
Don't you regard Perl as a functional language too? Perl is mostly Lisp semantics with mostly C syntax, with lots and lots of tasty syntactic sugar.
David M
@David M: I wouldn't call Perl a functional language per se, but it does contain functional constructs and can be used in a very functional fashion. The same can be said for it as an OO language or a procedural language - it's very multi-paradigm and lets you freely mix and match, which is, IMO, one of its greatest strengths.
Dave Sherohman
True, Perl allows for functional programming, but I still think learning something like Haskell will stretch the OP's way in a way that Python won't, given that the OP already knows Perl.
Dave Rolsky
Garett
A: 

I would definitely say yes to Python. It's a lot more fun to code in than Perl, IMHO. Frameworks like Django are nice, and you can even move over to .NET with IronPython.

Plus, it was named after Monty Python...what more reason do you need?!

But seriously, Python is a language that is only gaining in popularity, and would be a good one to know, I think.

adimauro
Did you tried Catalyst framework in Perl?
Alexandr Ciornii
We have different ideas about what's fun.
runrig
Didn't python go down on TIOBE recently? heh.
MkV
@runrig - Yes, our ideas of fun may be different, but that's why I said IMHO...we all have our preferences.@james2vegas - Yes, I just checked TIOBE, and Python slipped one from 6 to 7, while Perl jumped one from 9 to 8. But still, what I was really referring to was the fact that a lot of 'intro to programming' books/classes are in Python. One perfect example is the MIT Open Course Ware intro to CS, which is taught in Python.@Alexandr Ciornii - No, I never tried that framework.
adimauro
@james2vegas - Actually, if you look at the long term trends on TIOBE, it supports what I was saying. Python has an overall up trend since about 2004, while Perl has been dropping steadily during the same time period.But, overall I have to emphasize once again...it is just my opinion. I enjoy Python. Can't we all just get along? :)I have bad memories from my Perl Bioinformatics class...maybe that has tainted my judgment. :)
adimauro
@james2vegas: TIOBE is seriously flawed.
Alexandr Ciornii
A: 

You may want to check out ruby.

I can't give you an accurate comparison between python and ruby, as I last did serious python programming 9 years ago, and I only started using ruby in 2007.

Andrew Grimm