LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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

Reply
 
LinkBack Search this Thread
Old 07-03-2005, 12:30 AM   #1
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Rep: Reputation: 120Reputation: 120
Python - worth learning?


I just have a question. I am beginning to learn Python, but so far I've not been impressed with the language structure. It resembles BASIC too much and it's syntax is quite awkward for me coming from a C, C++ background. Also I am uncomfortable with the loose typing (no variable declarations) and so on.

But I have heard many good things about Python. My question to experienced Python programmers is : Is it worth learning Python?

I am familiar with PHP and find it much more comfortable although I haven't really had too much to do using it so far.

Thanks.
 
Old 07-03-2005, 12:36 AM   #2
redhatrosh
Member
 
Registered: May 2004
Location: Student of University of Mumbai, Maharastra State, India
Distribution: Redhat Linux 9.0, Knoppix LIVE CD, Ubuntu Live CD, Kubuntu Live CD
Posts: 483

Rep: Reputation: 30
I dont really know much about Python and haven't learnt it. But becoz Python is a Object Oriented Programming I feel it is an important language to learn and develop things much better.
Well, I also have one question!

Is Python Cross platform oriented like Java...or how is it functioning actually...(again to all the programmers who are experienced!)
 
Old 07-03-2005, 12:38 AM   #3
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Original Poster
Rep: Reputation: 120Reputation: 120
Python is an interpreted language and it is cross-platform (to the extent that systems with Python interpreters will run any python program).

I really don't know whether it's object oriented capabilities are superior to Java. At first sight Python's lack of structure or strong typing seems to be pretty much against it.
 
Old 07-03-2005, 05:13 AM   #4
NCC-1701&NCC-1701-D
Member
 
Registered: May 2005
Distribution: Debian Woody,Knoppix
Posts: 88

Rep: Reputation: 15
Every language is worth learning. Pyhton can help you create very good apps, cross platform and it's easier than C/C++/Java. If you have a look at sourceforge you'll see that many projects are in python. Give it a try!
 
Old 07-03-2005, 05:45 AM   #5
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
Whilst I don't know python, I know a few friends who do and they love coding in python and think its a great language, I intend to learn python, but one thing at a time - I'm learning C at the moment.
 
Old 07-03-2005, 06:10 AM   #6
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Original Poster
Rep: Reputation: 120Reputation: 120
Maybe it's just my basic aversion to any language that does not have formal and compulsory variable declaration...

Also maybe I am just used to ending all statements with a semicolon

Python looks good, but I don't see what it offers beyond Java to be honest. But I'm going to learn it anyway and see what I can do with it.

Any ideas for a good project with python?

Last edited by vharishankar; 07-03-2005 at 06:12 AM.
 
Old 07-03-2005, 07:41 AM   #7
Michael Johnson
Member
 
Registered: Jul 2005
Location: Wagga Wagga, Australia
Posts: 262

Rep: Reputation: 30
Try a programme to organise you photographs. This will test almost every aspect of your capabilities apart from mutlimedia (unless add sound).
Second thought turn your photographs into a movie and really test your skills.
 
Old 07-03-2005, 09:14 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,459

Rep: Reputation: 352Reputation: 352Reputation: 352Reputation: 352
Quote:
Python looks good, but I don't see what it offers beyond Java to be honest.
You can try Jython or Groovy, for the best of both worlds ...
 
Old 07-03-2005, 12:53 PM   #9
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Python is definitely worth learning. It is becoming more and more prevelant as the scripting language of choice in certain areas (e.g. the Ubuntu distro makes use of Python considerably to provide various add-ons like their menu editor project).

The fact that variable types are not decalred is often met with reservation by folks who come from a background of languages that require lots of type declarations. For example, I have a C++ background. I was a little concerned that not having the types of variables explicitly declared might lead to some headaches. But I found that in practice, not declaring the types just saved me a lot of extra typing on the keyboard. A parallel I like to draw is that in modern practice, a lot of emphasis in C++ is being placed on the practice of using templates and meta-programming techniques. The idea is to get the compiler to infer and generate types for you. It turns out that the actual type of an object isn't so important as th fact that it conforms to a set of behaviors that operate on it. It turns out that in Python, this is exactly what you get. Here is a quick example:

Code:
template<typename T1, Typename T2, Typename T3>
T3 add(T1 t1, T2 t2)
{
   return t1 + t2;
}

def add(t1, t2):
   return t1 + t2
What is interesting in both these cases (C++ and Python), is that the types of the operands are not particularly significant. What is important is that you must be able to add the first and second parameters together and return the result. In C++, the compiler will catch this problem at runtime if the types don't support the addition operator (+). In Python, the error is caught at runtime with a nice, built-in stack trace. The fact that I can focus on coding the problem at hand rather than focusing on the syntax of what I want to describe more than makes up for the early constraint checking, in my opinion.

Also, Python is considered a very straightforward language with very few surprising idioms. This makes it easy for someone who does not have a lot of hard-core programming experience to work with the language.
 
Old 07-03-2005, 08:12 PM   #10
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 30
Hari,

I'm not a huge fan of Python either. You wrote:

> Python looks good, but I don't see what it offers beyond Java to be honest.

and I'm inclined to say that I don't see what it offers beyond Java either.

In general, scripting languages are for gluing together command line apps and for dealing with text. bash does this pretty well, Perl does it too, and Python can do it well enough also. When you want a general purpose programming language though, I'll head straight for Java. It's not flashy and it's a bit verbose, but for large apps, I think it's the way to go. It seems to me that Pythonistas try to sell Python as a general purpose programming language, but I don't buy it. My hunch is that lack of static type checking at compile time just sets you up for hunting hard-to-find bugs later on at runtime.

BTW, Python is in fact a strongly typed language. Types matter -- it's just that they matter at *runtime*, rather than when you actually compile the code (yes, Python is compiled, just like Java or Perl -- it happens quickly first thing when you run the script). Python is strongly typed, but also *dynamically* figures out the types of objects when required.
 
Old 07-03-2005, 09:16 PM   #11
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Original Poster
Rep: Reputation: 120Reputation: 120
JohnMG thanks for that interesting bit of info.

Regards.
 
Old 07-04-2005, 05:53 AM   #12
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Original Poster
Rep: Reputation: 120Reputation: 120
Success. I learnt two new things today.

Python and ncurses with Python.

I developed a tiny little 'thought for the day' program using it, reading lines from a file and randomly displaying any one of them in a terminal window.

It is a bit like fortune program, but this is displayed in an ncurses window with a blue screen.

Nice!

Python tends to grow on you. But I still am not convinced of its true 'object' oriented nature though.
 
Old 07-04-2005, 12:55 PM   #13
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Not sure what you mean by "...true 'object' oriented..." nature. I have observed the object-oriented model is somewhat vague and open to various interpretations. There are certainly commonalities throughout various languages, but it is hard to say "here is archetypical example of object-orientedness".

Python provides multiple avenues of approaching programming. OOP is one valid approach, but I have seen procedural and functional approaches used as well.
 
Old 07-04-2005, 01:03 PM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally posted by carl.waldbieser
"here is archetypical example of object-orientedness".
I'd most certainly say that smalltalk does deserve that title ;)



Cheers,
Tink
 
Old 07-04-2005, 03:25 PM   #15
YaHu
LQ Newbie
 
Registered: Jun 2001
Location: SF Bay Area
Distribution: Debian (right now)
Posts: 24

Rep: Reputation: 15
Quote:
Originally posted by carl.waldbieser
[B]Python is definitely worth learning. It is becoming more and more prevelant as the scripting language of choice in certain areas (e.g. the Ubuntu distro makes use of Python considerably to provide various add-ons like their menu editor project).

...]
Python's nice, but if you don't need the Python libraries I prefer Ruby.
OTOH, Pyrex is a nice extension to python, that lets you easily blend Python, where you want flexibility, with C where you want performance. (Note that there is, as one would expect, overhead in the connection, but if you properly divide things that can be minimized.)

Python doesn't have much in common with Basic...actually, I feel that it has less in common with it than C does. It's mode of structuring code through indentation can take getting used to, but really isn't THAT bad once you get used to it.

Relatively speaking, Python is a slow language. It's certainly no faster than Java. OTOH, writing the code is a lot faster once you get used to it. (There's LOTS of libraries to make some things easy, and slow things fast.)

Worth learning? Depends on your purpose. Languages I currently find worthy are Ruby, Python, D (Digital Mars D == dmd). On the fringe are Eiffel, Ada and Smalltalk. I don't consider either C or C++ as worthwhile because of the mess they cause with their insistance on pointers everywhere. A compiler should HIDE that garbage from you, for two reasons:
1) It's quite easy to make mistakes
2) It makes garbage collection difficult to impossible.
(Note that all of my top tier of languages have garbage collection built in. If you're into hard real-time programming, then you have considerations that make these languages a poor choice.)

It's not that I can't program in C (and a doggerel of C++), it's that I despise doing so. My disgust with pointers didn't come quickly, but only through bitter experience...and trying to figure out what someone's code was doing when he cast a int to a pointer...without decent documentation, and with obscurely named variables.

(All that said, I do prefer C over Basic, but it's a close try...and I prefer Java over either, but even Java didn't make it into the top two levels of what I consider a good programming language. [P.S.: My comment about Eiffel is a couple of years old. The language appears to have been going through a bunch of redesigns recently, and I don't know what the current version is like. The rumors haven't been encouraging, so perhaps it should be moved down below the second tier...but it DOES have garbage collection.])
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is Visual Basic worth learning? titanium_geek Programming 20 07-07-2005 09:58 AM
GTK Programming Worth Learning drdroid Programming 3 04-14-2004 04:37 PM
Is it really worth learning vi at this point? Tyir Linux - General 8 02-24-2004 12:51 AM
Try Python, O'reilly Learning Python haknot Programming 5 02-15-2002 08:27 AM
Is scripting worth learning ChimpFace9000 Linux - General 3 07-05-2001 04:02 AM


All times are GMT -5. The time now is 08:02 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration