• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Perl vs Python

LuckyTaxi

Diamond Member
Buddy of mine introduced me to python and so far so good. I love it.
However, it didn't hit me until I tried moving my code over to an older version of RH, which has an older version of Python. I banged my head a few times trying to modify the code to run on an older version of Python. I eventually gave up and question whether I want to go that route or stick with Perl (never had an issue porting from CentOS 5 to older version running on RHEL 4).

With that said, how do you guys manage to work with work with code that's geared towards a newer version of the underlying compiler itself when there are multiple platforms to support? My thing is, what's the point of learning new syntax in let's say in the latest Python when I still have to learn the old syntax for the older platforms I support? With Perl, it just seems to work. 😀
 
Your problem isn't specific to Python (though its very obvious in Python -- two ways to do everything). To some extent, all language tools have this feature: the acceptable syntax changes (I'm looking at YOU, gcc), libraries are added, etc. In this case, you got lucky with Perl in that your personal Perl subset was in turn a subset of acceptable Perl on your target platform.

The best approach for portability is to learn core language features and use them, rather than rely on libraries. In Python, this ends up making no sense at all, because the whole point of Python is to be productive.
 
I agree, it's just tough when you find this new and improve way of doing things and then having to go the "old" route when having to port the code backwards.
 
Well, to be fair, learning new language syntax's are not all THAT hard. However, I agree that its a pain to have to rewrite code to get it to work for a specific version of the language. Python is still growing so there might be a few more times where you have to go through some fairly major syntax changes before things becomes somewhat stable.

That being said. If possible, Sometimes it is easier to just use the lastest version of language x, and then update everything you install the software on to that version.
 
There are always going to be new things in new versions of languages. Backporting to an old version without that feature will always be hard.

The nice thing about Python is that the developers think several versions ahead. Furthermore, they let you use some of the upcoming improvements by importing from "__future__".
 
Were you working with Python 3.0? 3.0 introduced a lot of changes that broke backwards compatibility with Python 2.5 and earlier. Python 2.6 has a mode that will issue warnings if the code won't run under python 3.0 to help with developing for both platforms.

ex. Do you use: 'print "hello world"' <==== Python 2.x
or 'print("hello world")' <==== Python 3.x

2.6 accepts both methods.

PS I've just started learning Python over the last week, so perhaps someone who knows better can validate/expand upon this.
 
If you want to support all sorts of different platforms I don't see how you can get around this. You have to stick to the core or risk your app breaking on some edge case platform.

One of the cool things about Java, .NET, etc. is you can target a specific runtime version. I think you can only run one version of python on a box at a time.
 
One of the cool things about Java, .NET, etc. is you can target a specific runtime version. I think you can only run one version of python on a box at a time.

You can always target version <= V.
 
As mentioned before, with Python this is an issue simply because we're transitioning from 2.x to 3.0 right now. If there is no way for you to upgrade the Python on your RHEL system, I'll recommend you learn Perl.

I'm not saying that Perl is better than Python. (I have a love/hate relationship with Perl and just met Python recently) But, for now, the syntax (?) of Perl will be the same. (as far as Perl syntax goes) But, Python is in a state of flux.
 
Back
Top