开发者

How does Python stack up to other scripting languages? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answ开发者_StackOverflowers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago.

I'm learning Python (and it's my first programming language so don't be too intense with your reasons) and I wanted to know how it stacks up to other scripting languages, like Perl and Ruby. What is Python better in comparison to other scripting languages, and what is it worse for?


First off, an advice - look for POSITIVE things said from opposite sides. Meaning, you should trust positive things said about Perl by Python-related sources (or positive things said about Python by Perl related sources) much more than the opposite.

The two reasons are that:

1) People who have reason to like Python would NOT be inclined to say good things about Perl unless they were truly trying to be objective (which is what you ideally want). And vice versa - it's a problem with human biases and motivations, NOT with either Perl or Python.

2) People writing such comparisons favoring one language are VERY often completely mis-informed and not very practiced about the one they are unfavorable about. As evidence see this article: http://python.about.com/od/gettingstarted/ss/whatispython_5.htm - pretty much anything it has to say about Perl is, to put it gently and mildly, a comlpete and utter bunk. I'm sure there are equally moronic Python put-downs from Perl fans, I just never read enough about Python to be able to think one up off the top of my head.


Second, please be aware that, at least for Perl - and I strongly suspect, for Ruby and Python - the moniker of "scripting" language is not really applicable anymore.

Yes, their (especially Perl's) origins are somewhat connected to shell scripting, and yes, a small subset of the languages capabilities can be - and are - used to write shell scripts, and make that small task very easy and extremely productive.

However, at this point in its long history, Perl is in no way even remotely restricted to those capabilities, and is used for developing anything from scripts to web frameworks to servers to large scale enterprise software to bio-informatics software.


Third, please look at this - it has a lot of links:

http://wiki.python.org/moin/LanguageComparisons


I'm learning Python (and it's my first programming language so don't be too intense with your reasons) and I wanted to know how it stacks up to other scripting languages, like Perl and Ruby. What is Python better in comparison to other scripting languages, and what is it worse for?

IMO.

I have tried Python 2.x for some time and went back to the Perl and C++.

What is good about Python. Python features better portability and has modern GUI libraries. Standard library in some places is also very very nice (I esp. liked random). Execution speed of arithmetic expressions beats that of Perl.

What is bad about Python. Poor documentation. No warnings, no typing whatsoever combined with weak typing/language's dynamic nature is a hell. Learning easy - using hard, mainly due to immature optimizer driving the need to think about performance edge cases quite early in the development cycle. (That some times reminded me of the Pascal.) OO is a mess at the moment: distinct features and differences between old-style and new-style classes are not spelled out very well; libraries do not mention what type of classes they do define.

Poor documentation probably should be highlighted. There are piles of standard functions but their purpose in life isn't really specified nor decent examples are given. And better half of those standard functions in Perl land would have been sitting somewhere in the perldoc perlguts. Anyhow, looking up stuff is much faster with Google.

Lack of warnings and lack of typing (and that compared to the weak Perl's use warnings/use strict and sub prototypes) is what in the end drove me back. Partially it is because that I write code faster than I can read it thus I like to rely on the compiler/interpreter to tell me where I might have wrote something I haven't really meant.

Also excuse me, but I would throw that at Python again: using indentation to denote code structure is kind'a kinky. I do not mind it per se and for short functions it is very nice. But after one week I have found that I do read Python code slower (compared to C++ or Perl) in greater part because I have to always extra check whether the statement really closed or it still goes on. If code doesn't fit one screen, it becomes a chore to always press PgDown/PgUp just to check. Never before I were that appreciative of the {}s.

All considered, Python is at the moment a mess. Worthy contender I do keep an eye on, but not mature enough for my daily needs. If I were making decision about learning Python now, I would have instead waited for Python 3.x to mature. Many things one would learn now with Python 2.x might be useless in Python 3.x. And Python 3.x is at the moment isn't very useful since many libraries were not yet ported to it.

P.S. Most bogus part I have encountered is the function pointers. I have discovered them sooner than I needed them by writing start_time = time.time and time_elapsed = time.time() - start_time. Half hour later when script finished instead of results I was presented with nice interpreter exception telling me that I cannot subtract function object. And the half hour was due to the standard for loop, as tutorials have taught me. Optimizations I have looked up later (range vs. xrange, manual loop unrolling) made the script run in less than one minute.


Here is a nice overview of why Python (the language) is a very nice place to start programming: http://www.python.org/about/

Python includes a very comprehensive standard library (i.e. "batteries included") which allows you to solve many programming problems.

Once you've learned Python, I'd suggest you also learn other languages such as Ruby, because different languages provide different paradigms for thinking about programming, thus expanding your knowledge of models of computation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜