Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Development & Programming > Programming Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Programming Talk
This forum is for all programming questions.
The questions do not have to be directly related to Ubuntu and any programming language is allowed.

 
Thread Tools Display Modes
Old October 15th, 2007   #1
pmasiar
Day Old Decaf
 
Join Date: Jun 2006
Location: CT, USA
Beans: 5,268
Ubuntu 6.10 Edgy
Why to love/hate Python

To avoid shifting threads off-topic by responding to relative merits of Python (which is my preferred language), I decided to start this thread. If we can have sticky about such personal preference as IDE is, why not this, right? Selecting proper language seems to me deeper question.

Bunch of links to get context why I love Python:
  • Freedom languages vs. safety languages comparing languages in what is central: power and productivity of individual programmer, or checkpoint to secure communication between modules.
  • Why I love Python (zip) - slides by famous Java/C++ expert Bruce Eckel, author of Thinking in... series
  • "Readability counts". In other languages, (yes, Perl, I am looking at you! ) it is very hard to read code of people who use different coding standards. By making indent rules part of the standard (and btw it is normal coding practices, as you would do anyway), code of all people becomes readable. See also Myths about Indentation and howEric Raymond got scared by it at first, but "Python's use of whitespace stopped feeling unnatural after about twenty minutes" and now he prefers Python over Perl for any code above 100 lines.
  • Edit: Please do not whine about tabs and spaces. Any decent editor can convert tabs to 4 spaces for you, and if it cannot, it is good enough reason to dump it and use real editor which can. It was unusual for me to, but after couple of minutes, it is normal, and no problem at all.
  • People who need to code only occasionally prefer Python, because it is forgiving and simple to remember. And because non-professionals are 90% of the market, Python is not hype, but language for next 100 years
  • Bruce Eckel explains dynamic (latent) typing, also in artima blog, how to argue about it, and why he is over with static typing. Bruce's view about Python

This hopes be discussion on facts, not flamewar. So I try my best, but cannot be hold responsible for others. It is also possible that this will earn me ban. We will see.

Last edited by pmasiar; October 26th, 2007 at 04:26 PM.. Reason: added B.E. blogs about typing
pmasiar is offline   Reply With Quote
Old October 15th, 2007   #2
pmasiar
Day Old Decaf
 
Join Date: Jun 2006
Location: CT, USA
Beans: 5,268
Ubuntu 6.10 Edgy
Re: Why to love/hate Python

(In response from post about C
[C/Java has more resources than Python online]
One of the reasons (at least for python and for me) might be that I needed substantially less resources to get started with Python than with Java. Java is just so byzantine complicated. My "Java in a nutshell, 1.3" has 646 pages of standard format, "Python pocket reference" (2.4) has 148 pages, and pages are half the size. You need many more books to get reasonable comprehension of Java than for Python.

Last edited by pmasiar; October 15th, 2007 at 01:48 PM..
pmasiar is offline   Reply With Quote
Old October 15th, 2007   #3
Wybiral
Tall Cafè Ubuntu
 
Wybiral's Avatar
 
Join Date: Oct 2006
Beans: 2,678
Ubuntu 7.10 Gutsy Gibbon
Re: Why to love/hate Python

I like Python because I came into it from the world of Assembly, C, and C++. After that, you can really appreciate the beauty and simplicity of Python and you will notice a remarkable increase in your productivity. Another thing I like about Python is that you don't have to spend hours searching the web for libraries, Python comes with almost everything, and what it doesn't come with is always easy to find.

An even bigger reason why I'm so interested in Python is that my goal is to be hired at a smart and productive company like Google, who uses Python in applications such as Google Maps, Gmail, YouTube, and even in parts of its search engine. If the geniuses at Google think it's a good language, then it's probably a good language.
__________________
Wybiral is offline   Reply With Quote
Old October 15th, 2007   #4
Unterseeboot_234
Way Too Much Ubuntu
 
Unterseeboot_234's Avatar
 
Join Date: Sep 2006
Location: Germany
Beans: 251
Ubuntu 9.04 Jaunty Jackalope
Re: Why to love/hate Python

This thread shouldn't be so prickly. I can only offer you an opinion. After 10+ years with all the Java updates, I can tell you I found Python very refreshing getting back to modules. Java is monolithic. We can make java code work and then discover it was a freak that the code was working. With java it could mean a total redesign of legancy code to bridge into new java APIs. I got tired about that part. Java is template coding. Set up a template, customize it, set up a template, customize it, set up...

Python, on the other hand, and as far as I'm concerned, never was documented. The O'Reilly series of Python titles come a long way showing pieces of interesting cause and effects. The code in the books make perfect sense. And then you discover how tricky dynamic typing can be doing your own stuff. What works as a Python module takes a lot more thought when you convert such code into a class.

The most wonderful discovery for me about Python was making the Linux terminal echo commands from Python statements. I found an easy way to process hundreds of digital photos using Python with ImageMagick (and I don't have to use ImageMagick's internal script engine). Ubuntu has capabilities like ImageMagick already built into it. Starting a discussion about Python using those capabilities would be useful. Very userful.

Java with its JRE can enhance Linux. Linux can NOT do audio without add-on hardware. So, as I make more progress with Python, I plan to see what Jython can do with Java ME2, and Java Media Framework.

So, Python. If it's just for fun.
__________________
"You don't do art because you want to, no, you do art because you have to." -- M. Buonarroti
Unterseeboot_234 is offline   Reply With Quote
Old October 15th, 2007   #5
AntiRush
First Cup of Ubuntu
 
Join Date: Aug 2007
Beans: 11
Re: Why to love/hate Python

Quote:
Originally Posted by pmasiar View Post
My "Java in a nutshell, 1.3" has 646 pages of standard format, "Python pocket reference" (2.4) has 148 pages, and pages are half the size.
To be fair you cannot compare those two books. Java in a Nutshell is a book meant to teach Java and goes into a lot of depth. Python Pocket reference is just that - a reference not meant to teach but to be used as a resource.

In fact, Python in a Nutshell has 654 pages.

Don't get me wrong, I use both python and java quite often and like bits of both languages. It's just not a fair comparison.
AntiRush is offline   Reply With Quote
Old October 15th, 2007   #6
CptPicard
Iced Blended Vanilla Crème Ubuntu
 
CptPicard's Avatar
 
Join Date: Aug 2006
Location: 60°27'48"N 24°48'18"E
Beans: 2,860
Kubuntu 8.10 Intrepid Ibex
Send a message via ICQ to CptPicard Send a message via MSN to CptPicard
Re: Why to love/hate Python

Nothing wrong with Python per se really, I use it actively myself... but I am not a true believer. Python has this perpetual feel of enforcing training wheels on you, while for some reason it is called a "freedom language". The fact and the way that Python enforces style seems to fly in the face of the idea that "programmers are consenting adults".

Now... style is a good thing, and I am slightly partial to languages that are "pure" stylistically as that often produces a kind of economy into the language. You know how things work because things are consistent. It's just that Python seems to enforce stuff in the wrong places, and sometimes the wrong way, despite supposedly being flexible. It's hard to put my finger on it what it is about, but sometimes Python feels petty for no reason

Of course, my primary complaints are the old ones... semantic whitespace is still awful, some syntactic constructs are missing or have to be implemented in an ugly way just because "they can be done otherwise", Python's classes feel a bit like an afterthought... yes, I don't like explicit self. I never rename "this" in other languages either. I'm sure the idea behind this is the ability to more easily just tack a function onto an object, or something like that... but Python's classes are so amorphous already that soon we'd just as well move back to procedures manipulating tuples

But, they are of course nitpicks. Fun ones, for sure, programming language differences are wonderful fodder for religious disputes...
__________________
Unmoderated, smart programming discussion with pmasiar, LaRoza and others here. | #ubuntu-programming on FreeNode
CptPicard is online now   Reply With Quote
Old October 15th, 2007   #7
pmasiar
Day Old Decaf
 
Join Date: Jun 2006
Location: CT, USA
Beans: 5,268
Ubuntu 6.10 Edgy
Re: Why to love/hate Python

Quote:
Originally Posted by AntiRush View Post
Java in a Nutshell is a book meant to teach Java and goes into a lot of depth.
My copy is "desktop quick reference", and has very little of explanation: just mentions classes and methods, one per line. Maybe you confuse it with some kind of much thicker books, like Java Bible, Shipping Weight: 3.8 pounds?

To be fair, I never seen any "pocket size" reference book for java.

P-N book has much more detailed info that J-N (I just opened in via Safari), with details and comments, multiple lines per item. Big part of P-N is just reprint of standard docs, thats why I like "pocket" book more, because lot of thought went in to compressing the info, make it more succinct, without withholding important parts.
pmasiar is offline   Reply With Quote
Old October 15th, 2007   #8
mjwood0
Gee! These Aren't Roasted!
 
mjwood0's Avatar
 
Join Date: Aug 2005
Beans: 179
Ubuntu 9.10 Karmic Koala
Re: Why to love/hate Python

To be fair, though I'm really more into C due to my job relying on it, I really am interested in learning Python. In fact, I've downloaded some reference manuals and the Dive into Python book from the documentation thread and am planning on looking at it tonight.

I don't expect it to replace C for me, but I really am looking for an easy to use scripting language. I've tried to learn Perl hundreds of time it seems. While I always end up with something that works, I think the old acronym for perl (Perl = Pathologically Eclectic Rubbish Lister) is somewhat true. I can never actually wrap my head around it enough to not have to go back to basics every time I go to maintain one of the scripts I've written in it. From what I've seen of Python, it's the perfect fit for this task.

I do have to say though -- the use of syntactic whitespace scares me just a little...
__________________
Linux User #395848
Blog: http://digitalnotions.net
mjwood0 is offline   Reply With Quote
Old October 15th, 2007   #9
Wybiral
Tall Cafè Ubuntu
 
Wybiral's Avatar
 
Join Date: Oct 2006
Beans: 2,678
Ubuntu 7.10 Gutsy Gibbon
Re: Why to love/hate Python

Quote:
Originally Posted by mjwood0 View Post
I do have to say though -- the use of syntactic whitespace scares me just a little...
It scared me too, but now when I have to program in C or C++ I'm always thinking "What? You mean I actually have to type all these stupid semicolons and brackets?". Indentation is a must for good code anyway, just think of Python as not having semicolons or brackets.
__________________
Wybiral is offline   Reply With Quote
Old October 15th, 2007   #10
mjwood0
Gee! These Aren't Roasted!
 
mjwood0's Avatar
 
Join Date: Aug 2005
Beans: 179
Ubuntu 9.10 Karmic Koala
Re: Why to love/hate Python

Quote:
Originally Posted by Wybiral View Post
It scared me too, but now when I have to program in C or C++ I'm always thinking "What? You mean I actually have to type all these stupid semicolons and brackets?". Indentation is a must for good code anyway, just think of Python as not having semicolons or brackets.
Fair... but I usually let XEmacs handle all the indentation. Guess I'll have to get used to doing it manually...
__________________
Linux User #395848
Blog: http://digitalnotions.net
mjwood0 is offline   Reply With Quote

Bookmarks

Tags
flamewar, python

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:50 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry