Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
07-27-2007, 05:42 PM
|
#1
|
|
LQ Newbie
Registered: Oct 2005
Location: Camelot
Distribution: cent, RH core, slax, slackware... *buntu...
Posts: 28
Rep:
|
My needs: Perl vs. Python
I've been reading up on this entire argument, and most of it seems like a bunch of fluff. I don't care about whitespace or cryptic code, or a lot of the other stuff people flame on about between the two. I can work just fine in ksh/bash. Bash feels the most comfortable, and I've written entire programs (5000+ lines) in Bash that people use on a day to day basis. I've also written a lot of "mission critical" applications in korn that my company relies and makes money on. I make heavy use of awk and sed, and standard UNIX utilities like wc, touch, grep and so on. Bash just works for me because I know it, and its there with every system I work on.
I have some desires that need fulfilling (i sound like my gf). I'll be finishing school come October, and would like to dedicate what free-time I have to learning a new language.
* a language that can produce and handle nice *attractive* GUIs
* something fast or minimalistic
* something that I can contribute to the Linux community with (very important as I'd like to leave it open as a second form of income or full time work in the near future)
* a language that can work on a variety of platforms... not just i386 PCs; cellphones? (i'm thinking OpenMoko)
* something (and I know this may sound bad) that I can make a decent living off of.
So? Anyone? I'm not looking for a replacement for Bash or Korn. I'm looking for something that could possibly work WITH these shells, but go deeper into the heart of the computer... something deeper than bash.
Something is telling me "PYTHON, dude!", but something else is saying, "Perl, Sir"...
Last edited by dave201; 07-27-2007 at 05:44 PM.
|
|
|
|
07-27-2007, 05:53 PM
|
#2
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
Disclosure: I am not a programmer.
You might want to learn an interpreted language like Python, but I would think you would want to know C regardless. I have been studying Python and one thing that got my attention was the statement that a typical application might be built in Python, but with specific modules in C (where the speed difference was significant).
|
|
|
|
07-27-2007, 06:01 PM
|
#3
|
|
LQ Newbie
Registered: Oct 2005
Location: Camelot
Distribution: cent, RH core, slax, slackware... *buntu...
Posts: 28
Original Poster
Rep:
|
I've got some c++ experience, up to "sets and gets" actually. I learned it freshman year in college while I was studying Mechanical Engineering...but never really did anything with it.
|
|
|
|
07-27-2007, 06:07 PM
|
#4
|
|
Member
Registered: Feb 2007
Posts: 59
Rep:
|
Perl,
or c in gtk.(it was pleasant experience).
http://o-hand.com/
|
|
|
|
07-27-2007, 10:05 PM
|
#5
|
|
Member
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892
Rep:
|
Perl & Python are not fast.
Java is not minimalistic.
The only language I know that suits your expectations is C.
As far as your contribution to the F/OSS community goes, how about helping GDB with their time-traveling debugger?
|
|
|
|
07-28-2007, 01:38 AM
|
#6
|
|
LQ Newbie
Registered: Jul 2007
Location: Bristol UK
Distribution: RedHat, Cygwin
Posts: 14
Rep:
|
Quote:
|
Originally Posted by dave201
I've been reading up on this entire argument, and most of it seems like a bunch of fluff. I don't care about whitespace or cryptic code, or a lot of the other stuff people flame on about between the two. I can work just fine in ksh/bash. Bash feels the most comfortable, and I've written entire programs (5000+ lines) in Bash that people use on a day to day basis. I've also written a lot of "mission critical" applications in korn that my company relies and makes money on. I make heavy use of awk and sed, and standard UNIX utilities like wc, touch, grep and so on. Bash just works for me because I know it, and its there with every system I work on.
I have some desires that need fulfilling (i sound like my gf). I'll be finishing school come October, and would like to dedicate what free-time I have to learning a new language.
* a language that can produce and handle nice *attractive* GUIs
* something fast or minimalistic
* something that I can contribute to the Linux community with (very important as I'd like to leave it open as a second form of income or full time work in the near future)
* a language that can work on a variety of platforms... not just i386 PCs; cellphones? (i'm thinking OpenMoko)
* something (and I know this may sound bad) that I can make a decent living off of.
So? Anyone? I'm not looking for a replacement for Bash or Korn. I'm looking for something that could possibly work WITH these shells, but go deeper into the heart of the computer... something deeper than bash.
Something is telling me "PYTHON, dude!", but something else is saying, "Perl, Sir"...
|
I would advocate Python.
5000+ lines of bash is a lot of bash scripting! Python would help in organising large programs for easier development and maintenance with features such as functions, modules, and classes that allow you to break that big idea into manageable interacting chunks that might even be developed and tested separately before integration and testing as a whole. New data-types and data-structures such as long-integers, decimals, sets and lists help in making the solution fit your pseudo-code design brief.
Python is not a bash replacement as it does not do the one-liner. But it is complementary to bash.
To go through your bullet list:
* Their are Python ports for a large number of GUI frameworks/libraries try googling for Python plus the name of a Linux GUI framework for an idea.
* You know how scripting languages are supposed to work, a bit of their own code gluing together other utilities; well Python does that with a twist: Python comes with its own extensive library - pre-installed, and is also used to wrap loads of other libraries written in other languages such as C, C++, and Fortran. If you look up IPython and Scipy or Biopython you will find Python based tools that scientists and engineers are using to do computationally intensive work with. Python is fast to develop, fast to test, and is usually fast enough - as you probably know 'cos when I was writing large awk programs I had my doubters that said I should use C for speed, until they saw the results developed in a very short time and being fast enough to not impact the overall time to completion of a task (whats three minutes when the output is going to take 6 hours of processing in the tool it is feeding).
* You want to contribute! Python is used all over the Linux world. Notables might be Ubuntu, OLPC, MAEMO, and openmoko.
* Python is being used on some of the smaller platforms such as OLPC and mobile phones. Its on a large range of desktop & server OS's too.
* Some do make a living off Python programming. A lot more, like myself, use Python to enable themselves to complete their main tasks - mine being to create and maintain design flows for our ASIC Design engineers to create microchips used in from mobiles to F1 racing car engine management systems (but I never get invited to a race  )
Your instincts are right, Choose Python!
- Paddy.
|
|
|
|
07-29-2007, 12:05 AM
|
#7
|
|
LQ Newbie
Registered: Oct 2005
Location: Camelot
Distribution: cent, RH core, slax, slackware... *buntu...
Posts: 28
Original Poster
Rep:
|
Quote:
|
Originally Posted by paddy3118
I would advocate Python.
5000+ lines of bash is a lot of bash scripting! It runs smooth too
Your instincts are right, Choose Python!
|
Ahh, thank you! Thats what I needed. Its been in the back of mind for quite some time now... I've pretty much accepted the fact I would tackle it eventually. Thing is, the head dev at my company told me on Friday to "learn perl and php" when she finally saw my bash code. I'd like to stay away from the userland-ish web stuff as much as possible. I'm not anti-social myself, just not very user friendly
Python it is! Can you, or anyone else recommend an interface for Python development? I've been doing things in viM far too long...
|
|
|
|
07-30-2007, 05:28 AM
|
#9
|
|
LQ Newbie
Registered: Jul 2007
Location: Bristol UK
Distribution: RedHat, Cygwin
Posts: 14
Rep:
|
Quote:
|
Originally Posted by dave201
Python it is! Can you, or anyone else recommend an interface for Python development? I've been doing things in viM far too long...
|
Vim's good. I use a mixture of vim and idle mainly myself.
|
|
|
|
07-30-2007, 08:48 AM
|
#10
|
|
Member
Registered: Dec 2005
Location: /USA/MI/Detroit/home
Distribution: MEPIS 6.5, Debian Etch & Sarge
Posts: 104
Rep:
|
Quote:
|
Originally Posted by dave201
* a language that can work on a variety of platforms... not just i386 PCs; cellphones? (i'm thinking OpenMoko)
|
Bless your heart!
sleepy
|
|
|
|
07-30-2007, 09:01 AM
|
#11
|
|
Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131
Rep: 
|
From what I read in your post, you're describing C. I've just started to study it ("for real") some time ago, and have used Python (and some others) before, and have to say that if I was to make a program that is likely to be distributed to somebody else than me myself, I'd definitely think about writing it in C. Python is good for a lot of stuff, but (at least as of now) it feels it's not for everything. It's handy for little tasks, and some big ones too, but like said, it's common to write parts of the big program in C (in the name of efficiency, for example) and then "glue it up" with Python. Good to know both.
There's nothing like Vim. After numerous editors and environments and this and that, I stumbled across Vim and started finding out how it works (before it's usage was plain hell to me) and today I can't think of much anything else, maybe Emacs, but apart from that.
Try C, at least. You'll learn Python in no time, but if you don't take time to learn C (it doesn't take that much either, though a little longer than Python) you could regret it some day when you don't have that time, just tasks.
|
|
|
|
07-30-2007, 10:43 AM
|
#12
|
|
Member
Registered: Jun 2005
Location: Indiana, USA
Distribution: OpenBSD, Ubuntu
Posts: 892
Rep:
|
Quote:
|
Originally Posted by paulsm4
... <talked about python editors> ...
|
Also, check out Pida: http://pida.co.uk/ -- it's Vim wrapped in some extra features (literally -- it uses Vim as an embedded editor), written in Python and incorporating some Pythonic benefits.
|
|
|
|
07-31-2007, 06:51 AM
|
#13
|
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,211
Rep: 
|
Quote:
|
something (and I know this may sound bad) that I can make a decent living off of.
|
in this case, perl is much more ubiquitous than python.
go to your favourite job site and search python jobs.
which is why I chose perl over python even though I think python
is much more elegant.
|
|
|
|
08-01-2007, 07:04 PM
|
#14
|
|
Senior Member
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 4,551
|
You are definitely going to generate a religious argument here, if anyone actually "bites." (Which is fairly unlikely.)
I do agree that "5,000 lines of bash" is a pretty-serious abuse of what bash was really intended for. It's supposed to be a shell, not a programming language.
I also agree that a high-level language is usually what is called-for. There are very few situations where you need to resort to "C" or "C++." Any high-level language system, be it Python or Perl or something-else, consists of tens of thousands of lines of "C" or "C++" code, all of which you can "simply use."
Realistically, in the Unix/Linux environment you are going to have to use both languages, so you may as well plan on learning both of them. It isn't hard. The more languages you know, the easier it is to grok the numerous similarities between all of them.
Given the choice, all things being equal, I have no doubt at all that you will consistently pick-up Python, and come to prefer it.
|
|
|
|
08-02-2007, 05:32 AM
|
#15
|
|
Guru
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.4, Centos 5.9
Posts: 14,973
|
I'd disagree with Perl not being fast. It's prob about 80-90% as fast as C.
I did C for about 8 yrs, then Perl for the last 6 or 7.
Never had a prob with performance that I couldn't solve with a better design/code.
It's certainly ubiquitous, even runs on VMS.
If you really want some definitve answers to what Perl is/isn't or can/can not do, ask at www.perlmonks.org, where the gurus hang out.
That said, it's pretty much your choice in most cases.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:41 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|