Linked by Thom Holwerda on Fri 10th Sep 2010 14:59 UTC
General Development Python programmers shouldn't get too smug. While many people agree that Python is designed in a way that makes it a highly readable language, there can still be problems with legacy, untested Python code too. Porting legacy Perl to Python can be a daunting task. In this article, learn some of the theory behind dealing with legacy code, including what not to do.
Thread beginning with comment 440749
To view parent comment, click here.
To read all comments associated with this story, please click here.
Member since:

Ok, maybe not syntax, but approach, logic. Java, Javascript or C# person will learn Python much faster than Perl.

Python syntax for objects and classes is more common with Java and C# or even PHP. Perl looks strange to Java and C# crowd. Python not so much, after you get used to mandatory indentation.

Reply Parent Score: 2

sorpigal Member since:

So in the end your argument comes down to "Perl OO is weird and different" -- well no kidding, every Perl programmer in the world has concluded that. It's why we have Moose and why that was one of the first things to be fixed in Perl 6. Perl OO sucks! Is there anything *else* that's fundamentally wrong with Perl?

Before you say "Readability" I will say "It's true," but only to a point. Perl is much more permissive and lets you get yourself in to readability trouble more easily than many other languages, but with a little discipline readable code is not hard to write. Any decent perl monger will do it as a matter of course.

Now *Python*, there's a readability nightmare! I've been programming for a decade and tried to muddle my way through a moderately complex Python program the other week to make one, small change (add an additional menu option which calls existing code, just for faster access). It took me four *hours* to get it working! For a one line change. And I *still* don't understand what all of the magic going on was.

You *can* write readable python code, but I've seen more than a few programs that are terse and mystifying, relying on implicit behavior, and so on. Weird syntax doesn't help, either.

For the record I know many languages from many families, just not Python.

Reply Parent Score: 2

reez Member since:

I never really got the readability thing. I mean nobody says C is crap, because it isn't readable. It is damn hard to read and I am not only speaking about obfuscated code like this:

I always had liked Perls approach to make the programming language more like a natural language.

Also compared to similar languages other than Python I never got that argument. Ruby for example never suffered from the hard to read argument.

Of course there is some yucky Perl code, but to me it looks like this has more to do with it's age. Older code is harder to understand in most cases. The reason seems to be that the way people think about stuff changes over time. Today OO is overly hyped. Don't get me wrong, I like OO. In fact I am very picky about what OO really should look like. For example I don't really like the C++ style, but prefer Smalltalk, Objective-C and Ruby.

But be serious. OO is just one of many paradigms and there are always new approaches. So it is better to use external extensions like Moose to keep up with newer ways. Functional programming is an other big thing, but there isn't really one right way. Perl is pretty good when it comes to adopt new things. Every time the Python, Ruby, Whatever guys come up with something new I can be sure I will soon be able to use this in Perl.

I really like Ruby and Python, but every time I work on a project I get frustrated, because they show me their borders. The fact that neither of them have as many modules as Perl is also very frustrating. OO is all about code reuse, but it sucks when I always have to reinvent everything.

Maybe a project like Parrot could change this. They also have pretty nice support for a bunch of languages and got pretty far. They'd just need some publicity. It would be really nice if all the programming language projects would work together instead of having to reimplement the same stuff all on their own. Especially stuff like porting the platform somewhere else. That lack of support for a platform really sucks. It's also one of Perl strengths. It runs virtually everywhere. Again some advertisement, because I think this project is way too unknown.

I guess I like the wrong stuff. Perl, Tcl, Smalltalk. All declared dead ;)

Reply Parent Score: 2

trenchsol Member since:

What is wrong with you ? I've said that people accustomed to Java and C#, which are popular languages, feel more at home with Python. I have never thought that there is something wrong with Perl.

I've also said that people who are not familiar with Perl should rewrite Perl programs, instead of trying to incorporate them in their own projects. I'd say that it is quite sensible advice.

Reply Parent Score: 2