LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 07-01-2009, 11:01 AM   #46
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138

This article has some pretty good points about "Why Python":

http://www.linuxjournal.com/article/3882

I myself have used Python and practically find it extremely productive because you can achieve a lot with less code. In my practical experience, the code I write in Python is far less error-prone than code I've written in C, C++ or any other language. It just expresses some things logically better than other languages.

Python is an interpreted language, but your development time is faster and you end up writing neater and more logical code. And right now, I find that it has a lot of extensions that really make it a richly productive programming tool.

Sure, the enforced whitespacing and indentation is a turn off for some, but actually I've developed a taste for it.

Last edited by vharishankar; 07-01-2009 at 11:06 AM.
 
Old 07-01-2009, 11:27 PM   #47
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Rep: Reputation: Disabled
The original question was ..."why was Python voted the language of the year?"

Let's stay on topic.




No, the original question (from page 1) was:
"What makes python so good and popular??"

...to which my response-

"The answer: Because Google is pushing it. IMHO, it's not good, it's lacking.

The question: What makes python so good and popular??"
...was right on topic.
 
Old 07-04-2009, 10:28 PM   #48
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
Quote:
Originally Posted by arfon View Post
The original question was ..."why was Python voted the language of the year?"

Let's stay on topic.




No, the original question (from page 1) was:
"What makes python so good and popular??"
...to which my response-

"The answer: Because Google is pushing it. IMHO, it's not good, it's lacking.

The question: What makes python so good and popular??"
...was right on topic.
That may be your opinion, but that doesn't make it the correct or wrong answer or perfect on-topic. Everybody is entitled to their opinions and every reply here has debated the merits/demerits of python which are relevant to the issue.

You cannot have a thread on "WHY WAS X VOTED APP OF THE YEAR?" without discussing the merits and demerits of that app.

Last edited by vharishankar; 07-04-2009 at 10:36 PM.
 
Old 07-05-2009, 03:50 PM   #49
arfon
Member
 
Registered: Apr 2004
Distribution: Slackware & RHEL
Posts: 376

Rep: Reputation: Disabled
Quote:
Originally Posted by harishankar View Post
That may be your opinion, but that doesn't make it the correct or wrong answer or perfect on-topic. Everybody is entitled to their opinions and every reply here has debated the merits/demerits of python which are relevant to the issue.

You cannot have a thread on "WHY WAS X VOTED APP OF THE YEAR?" without discussing the merits and demerits of that app.
Point 1: Well, that last statement (to which my last reply was referring to) was:

#45
jagooch
LQ Newbie

Registered: Sep 2008
Posts: 4
Thanked: 1

The original question was ..."why was Python voted the language of the year?"

Let's stay on topic.


Which it was not, if you read the first post on this thread, you will see that his question was: "What makes python so good and popular??"

I was correcting jagooch's post.

POINT 2: As for my statement that Python is really popular now due to Google pushing it... Okay, if you believe that I am wrong, prove it. Don't just say that I am wrong.
 
Old 07-05-2009, 09:56 PM   #50
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
I wasn't saying it was wrong. I was saying it is a matter of opinion. As far as I'm concerned, Python has been popular in the *nix community to a large extent even before google's massive push.

Of course, google are pushing Python. That has a lot to do with Python's merits and not the other way round. It's obvious that a commercial entity of the nature of google wouldn't invest heavily in a technology like Python without seeing the benefits accrued from using it.

So the principle of "Res Ipsa Loquitur" applies here. The burden of proof is transferred to the other party.

Last edited by vharishankar; 07-05-2009 at 10:00 PM.
 
Old 07-06-2009, 05:54 AM   #51
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by harishankar View Post
I wasn't saying it was wrong. I was saying it is a matter of opinion. As far as I'm concerned, Python has been popular in the *nix community to a large extent even before google's massive push.

Of course, google are pushing Python. That has a lot to do with Python's merits and not the other way round. It's obvious that a commercial entity of the nature of google wouldn't invest heavily in a technology like Python without seeing the benefits accrued from using it.

So the principle of "Res Ipsa Loquitur" applies here. The burden of proof is transferred to the other party.

Nothing is obvious.

I know another commercial entity which used to have its own HDL simulator and its own circuit simulator.

The commercial entity realized in the end that it would be better to use industry standard tools/languages - for various reasons.

I did read myself the blog of that Google Python advocate - his advocacy was to big extent based on his dislike of Perl.

From time to time in various forums Python advocates (some/most of them simply not knowing Perl well enough or at all) try to show how good is Python, but after my "coaching" they now at least ask whether a feature they like in Python exists in Perl.

The last feature I remember is array with fixed indexes - it happens to be that in Python by default that's the case, while in Perl by default arrays have unbound upper index.

Well, Perl has a module which allows to introduce upper array index bound (of course, this is trivially possible through "Tie" mechanism).

Again, so far I haven't been demonstrated a Python feature which doesn't exist in Perl, i.e. I see no practical reason for myself to switch.
 
Old 07-06-2009, 06:24 AM   #52
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
It might not be obvious to you, but it puts the burden of proof on your side, because Google, after all, make much bigger decisions than people like you and me and have a greater impact on technology adoption than you or me. It's all very well to condemn or criticize google, but the fact remains that google have adopted Python and Python IS a solid, proven language of choice of general purpose high-level development, like it or not.

I myself never found the need to use Perl, but I have a strong C/C++ background with knowledge of Java, PHP, etc. etc. Python looks the most elegant of these languages once you get past its syntactical quirks (as compared to other languages).

Perl code almost every time I look at it, looks a lot like assembly code on steroids. Maybe the fault lies with the developers, but I've never seen one Perl script that I could make out fully. Its reputation for being hard and tough is not unfounded, even if it might be untrue. Python, on the other hand, has been designed to be elegant from the ground up and doesn't expose so many features as Perl, but it is a RAD scripting language that is about as extensible as Perl is with modules.

Yes, I am aware that it's syntax is similar to C, but that's where the comparison ends.

Last edited by vharishankar; 07-06-2009 at 06:26 AM.
 
Old 07-06-2009, 06:29 AM   #53
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by harishankar View Post
It might not be obvious to you, but it puts the burden of proof on your side, because Google, after all, make much bigger decisions than people like you and me and have a greater impact on technology adoption than you or me. It's all very well to condemn or criticize google, but the fact remains that google have adopted Python and Python IS a solid, proven language of choice of general purpose high-level development, like it or not.

I myself never found the need to use Perl, but I have a strong C/C++ background with knowledge of Java, PHP, etc. etc. Python looks the most elegant of these languages once you get past its syntactical quirks (as compared to other languages).

Perl code almost every time I look at it, looks a lot like assembly code on steroids. Maybe the fault lies with the developers, but I've never seen one Perl script that I could make out fully. Its reputation for being hard and tough is not unfounded, even if it might be untrue. Python, on the other hand, has been designed to be elegant from the ground up and doesn't expose so many features as Perl, but it is a RAD scripting language that is about as extensible as Perl is with modules.

Yes, I am aware that it's syntax is similar to C, but that's where the comparison ends.

I saw unreadable Python code - because of the code author.

First and foremost, no language can save code in case of senseless names.

Elegance of Python is questionable - frequent usage if __self__ is an example.
 
Old 07-06-2009, 06:55 AM   #54
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Sergei Steshenko View Post

Elegance of Python is questionable - frequent usage if __self__ is an example.
if that's the only reason you think Python elegance is "questionable", you haven't seen anything yet. "self" is just a convention. one can give it an alias if one wants. Understanding why "self" is like that, requires you to know Python's OO internals, which i am sure you are not interested.
 
Old 07-06-2009, 07:30 AM   #55
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by ghostdog74 View Post
if that's the only reason you think Python elegance is "questionable", you haven't seen anything yet. "self" is just a convention. one can give it an alias if one wants. Understanding why "self" is like that, requires you to know Python's OO internals, which i am sure you are not interested.
AFAIK, according to Larry Wall, Perl 5 OO model was stolen from Python.

So, you are probably right - since I have some idea about Perl 5 OO internals, I am not that interested in Python OO internals.


The point, though, was frequent use if classes in Python.

The funny thing about classes in any OO language is that class names are global entities, so if there are too many of (top level) classes, there is a big(ger) chance of name collision.

...

Maybe later I'll write a gtk+ Perl bindings code - a full working example, and will ask to translate it into Python - to show the weak spots in Python and thus why one might decide to switch to Perl.

For the record so to say.
 
Old 07-06-2009, 08:24 AM   #56
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Sergei Steshenko View Post
Maybe later I'll write a gtk+ Perl bindings code - a full working example, and will ask to translate it into Python - to show the weak spots in Python and thus why one might decide to switch to Perl.
please post to comp.lang.python and not here.
 
Old 07-06-2009, 10:59 AM   #57
jagooch
LQ Newbie
 
Registered: Sep 2008
Posts: 7

Rep: Reputation: 1
Cool

Quote:
Originally Posted by harishankar View Post
That may be your opinion, but that doesn't make it the correct or wrong answer or perfect on-topic. Everybody is entitled to their opinions and every reply here has debated the merits/demerits of python which are relevant to the issue.

You cannot have a thread on "WHY WAS X VOTED APP OF THE YEAR?" without discussing the merits and demerits of that app.
Yes you can.


"Can it do all the thinks Java and C++ can??"
Python can thinks all it wants, but two heads are better than one, so unfortunately, it cannot keep up with the combined processing power of Java and C++.
 
Old 07-06-2009, 04:59 PM   #58
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally Posted by jagooch View Post
it cannot keep up with the combined processing power of Java and C++.
That maybe true, especially for C++ vs. perl/python. But certainly both perl and python beat both java and C++ in development effort. And C++ and java are certainly off-topic here btw.

I think between Perl and Python is merely a matter of taste. Or what you happened to learn first. No need to switch for either side IMHO. Both are in the "same market" of application area.

My taste is python (cleaner code), but I do see some merits of perl over python (swiss army knife, quick hacks, replace awk, sed, cut etc).

I was doubting quite long when deciding which of the two to learn. I choose python (it looked easier) and see no need to switch. If I had chosen perl, most probably I wouldn't see any needs to switch either.

The "discussions" about which is "better" are only kept alive by testosteron :-)
 
Old 07-06-2009, 08:03 PM   #59
Dan04
Member
 
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu
Posts: 207

Rep: Reputation: 37
Quote:
Originally Posted by Sergei Steshenko View Post
Well, Perl quite well implements "do what I mean" principle.

So, for starters, please translate the following into Python:

Code:
sergei@amdam2:~/junk> cat -n md_array.pl
     1  #!/usr/bin/perl -w
     2
     3  use strict;
     4
     5  my @array;
     6
     7  $array[0][1][2] = 123;
     8  $array[3][4][5] = 456;
     9
    10  warn "\$array[0][1][2]=$array[0][1][2]";
    11  warn "\$array[3][4][5]=$array[3][4][5]";
    12
    13  warn "\$array[3][4]=$array[3][4]";
sergei@amdam2:~/junk> ./md_array.pl
$array[0][1][2]=123 at ./md_array.pl line 10.
$array[3][4][5]=456 at ./md_array.pl line 11.
$array[3][4]=ARRAY(0x8194ddc) at ./md_array.pl line 13.
sergei@amdam2:~/junk> cat -n md_hash.pl
     1  #!/usr/bin/perl -w
     2
     3  use strict;
     4
     5  my %hash;
     6
     7  $hash{foo}{bar}{doo} = 123;
     8  $hash{goo}{dah}{bah} = 456;
     9
    10  warn "\$hash{foo}{bar}{doo}=$hash{foo}{bar}{doo}";
    11  warn "\$hash{goo}{dah}{bah}=$hash{goo}{dah}{bah}";
    12
    13  warn "\$hash{goo}{dah}=$hash{goo}{dah}";
sergei@amdam2:~/junk> ./md_hash.pl
$hash{foo}{bar}{doo}=123 at ./md_hash.pl line 10.
$hash{goo}{dah}{bah}=456 at ./md_hash.pl line 11.
$hash{goo}{dah}=HASH(0x8194e04) at ./md_hash.pl line 13.
sergei@amdam2:~/junk>
, and then we'll talk about human being concerned.
How's this?

Code:
#!/usr/bin/env python

from collections import defaultdict

my_dict = defaultdict(lambda: defaultdict(lambda: {}))
my_dict[0][1][2] = 123
my_dict[3][4][5] = 456

print "my_dict[0][1][2] = %r" % my_dict[0][1][2]
print "my_dict[3][4][5] = %r" % my_dict[3][4][5]
print "my_dict[3][4] = %r" % my_dict[3][4]
Code:
#!/usr/bin/env python

from collections import defaultdict

my_dict = defaultdict(lambda: defaultdict(lambda: {}))
my_dict['foo']['bar']['doo'] = 123
my_dict['goo']['dah']['bah'] = 456

print "my_dict['foo']['bar']['doo'] = %r" % my_dict['foo']['bar']['doo']
print "my_dict['goo']['dah']['bah'] = %r" % my_dict['goo']['dah']['bah']
print "my_dict['goo']['dah'] = %r" % my_dict['goo']['dah']
 
Old 07-06-2009, 09:05 PM   #60
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
During the course of any particular workday, I might work on (or look at...) code in three or four different programming languages. Including Python. From this perspective, I think I can make a few good points...
  1. In the real world, there is seldom if ever a practical reason to write a stand-alone executable program in "C" or even "C++," unless your goal is to produce a free-standing program such as ... say ... "yet another language."
  2. Scripting languages are one of the most practical notions ever invented. Learn 'em all.
  3. There is never (that's my opinion and I'm stickin' to it...) any practical reason to write anything in "bash scripting," which was never designed to be what all of these scripting languages were designed to be.
  4. There is seldom if ever a practical reason to quarrel religiously about scripting languages, even though plenty of people do.
Once a programming language reaches "critical mass," there is no turning back. Thousands of lines of production software have been written in it, and tediously debugged, and neither that software nor the language itself is ever going to be "rewritten." The more languages you know, the more indispensible you can make yourself. Also, you can make smarter decisions about what language to use on your next project... and why.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Review: Programming in Python 3: A Complete Introduction to the Python Language LXer Syndicated Linux News 0 01-26-2009 04:50 AM
python update - Unable to load GTK2 Python bindings: No module named gtk itpedersen Linux - Software 2 10-03-2008 03:44 AM
LXer: Charming Python: Python elegance and warts, Part 2 LXer Syndicated Linux News 0 08-31-2007 08:40 AM
LXer: Move to python 2.4 / Changing the packaging style for python packages LXer Syndicated Linux News 0 06-13-2006 07:54 PM
python problem - compiled from source - python -V still showing old version txm123 Linux - Newbie 1 02-15-2006 11:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration