Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why python ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks.
I have some questions about python.
I want to learn a scripting language and I am thinking about python or perl.
but as I know perl is not a clear language (or less well designed than as Eric Raymond said).
my questions are :
what are the capabilities of python ?
I mean, using java, I can write swing application or servlets or ejb or jdbc application or ........
what I can do with python ? what is the real usage of python ?
if you have any suggestions like : learn language X or ..... please let me know.
thanks.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Todd:
what are the capabilities of python ?
I mean, using java, I can write swing application or servlets or ejb or jdbc application or ...

You can't write a Swing application, nor servlets, nor EJBs, nor JDBC code with Python but you can write GUI applications, web applications, and database applications with Python.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any suggestion like don't go by python learn perl or learn ......
 
Adrian Yan
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perl 6 is supposely coming out with much better clean-room implementation. Python is a good scripting language. It really comes down to what you want to do. You can learn Tcl/Tk, Ruby.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perl is a prime example of what happens when open source people go overboard to want to please everyone by adding everyone's pet features without any regard.
It's so large, so cumbersome and so convoluted that it's gotten to be completely useless.

Python is nice and small yet powerful. Same for Ruby.
I am slowly learning a bit of Python to get away from being too focussed on Java, choosing Python over Ruby because there are more books for it (that's indeed the reason, I went to the computer bookstore and they didn't have a Ruby book I liked but several good Python books so I got those).
 
Tim West
Ranch Hand
Posts: 539
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perl is indeed overblown. See this if you're not convinced

I'm gonna go Python myself.


--Tim
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:

You can't write a Swing application, nor servlets, nor EJBs, nor JDBC code with Python


But Lasse does'nt jython allow us to write all of this?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by karthik Guru:


But Lasse does'nt jython allow us to write all of this?


yes it does, by allowing the use of Java classes inside Python code much as cPython allows the use of GTK.

Problem is that jython is not very active, development lags several years behind Python.
 
Arjun Shastry
Ranch Hand
Posts: 1898
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAIK Google search engine mainly consists of Python programs,right?Python is supposed to be powerul than Java interms of performance?I am not sure.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google indeed uses a lot of Python.
As to performance, I doubt it's faster.
The architectures of the runtimes are rather similar, but Python is untyped which may make it marginally slower as types need to be resolved runtime rather than compiletime.

Google also recently hired one of the core architects of Java itself, Joshua Bloch, away from Sun hinting that they may be thinking of moving (part of) their systems to Java.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arjun Shastry:
AFAIK Google search engine mainly consists of Python programs,right?
As far as I know, the actual search engine is implemented in C or C++ and Python is used to glue things together. Then again, this is just hear-say and I'd love to get some reliable information "from the source"...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:
Google also recently hired one of the core architects of Java itself, Joshua Bloch, away from Sun hinting that they may be thinking of moving (part of) their systems to Java.

And they're hiring more...
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what I understand, Python is 10x easier to learn than Perl. I took an Intro to Artificial Intelligence class and we did the whole thing in Python. He said in previous versions of the class when he'd had the students use perl, he couldn't give the first assignment til week 4, whereas with python, he could give us something to code the first week.

If you're interested in a few interesting programs you can code, check out the course website: http://plan.cs.drexel.edu/courses/intro-ai03/

I found it pretty easy to use, for loops are much simpler, and text manipulation is real quick. It took a while to get used to having code indenting MEAN something, but overall I liked it.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
As far as I know, the actual search engine is implemented in C or C++ and Python is used to glue things together. Then again, this is just hear-say and I'd love to get some reliable information "from the source"...

I just exchanged a couple of emails with someone who works for Google and he confirmed that they are indeed using C/C++ for performance critical components, Python for glueing things together, and Java for some front-ends like Google ads. Orkut is their first .NET experiment.
 
Derek Grey
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about PHP 5?

Isn't that a better and easier option to learn than Python? ... and I think it is capable of doing all the things that Lasse pointed out with Python.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by San Tiruvan:
What about PHP 5?

Isn't that a better and easier option to learn than Python? ... and I think it is capable of doing all the things that Lasse pointed out with Python.

PHP 5 could be easier to learn than Python, but I doubt it. Apparently PHP has got classes these days (can you tell I haven't written a line of PHP code since PHP3?) and I'm sure that's not the only enhancement they've done so it might be just as "complex" as Python, for example, in terms of concepts one must understand.

Besides, PHP is still very much web application-oriented so you can't really write a desktop application with PHP -- something you can easily do with Python, Ruby, Java, Groovy, etc.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:

Besides, PHP is still very much web application-oriented so you can't really write a desktop application with PHP -- something you can easily do with Python, Ruby, Java, Groovy, etc.


Are you sure about that? I'm pretty sure I remember reading something to the contrary.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
Are you sure about that? I'm pretty sure I remember reading something to the contrary.
Umm. Not really, but I did check out php.net before posting that and I couldn't find much evidence on the contrary. The front page says "PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML" and the manual has only one module related to GUI development. I admit that you can do all sorts of file processing with PHP and that can indeed count as "non-webapp development"...
 
Marcus Green
arch rival
Rancher
Posts: 2813
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done reasonably serious programming in

Java (of course)
Perl
PHP4

Of those I found Perl to be the least pleasant by a very, very wide margin.Possibly to the point the wild staring eyes and saying some very very unpleasent things about its creator Larry Wall.

PHP4 seems to have much of the class support I use in Java. Thus if you were to look at my code you would see the use of the new keyword with objects being passed around and the use of get/set methods. PHP5 extends on this with more features that would be familiar to a Java programmer.

I have never written a line of Python in my life but I have read endless very nice things about it. You might be able to find out about a fairly complex Python project by searching on chandler and python.

Marcus
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic