Tutorial :Python over JavaScript? (Facts, please) [closed]



Question:

I recently learned JavaScript an all of the sudden I hear about Python...

Should I go learn Python or just stick with my basic JavaScript knowledge?

If you have some "facts" I would love to hear them! Like efficiency, difficultylevel and so on, an so on...

Thanks :)


Solution:1

If you're just learning a language, then there is none better than Python. It's an easy language to pick up. It's well documented. It's associated with a large, active, and friendly community. Since it's a scripting language, you can easily try stuff out and immediately see the results. You can also build up from programming basics, starting by learning functions and then moving into classes.

Javascript is the bane of many a programmer's existences. It's easy enough to learn, and is good for small scripts which is what is was designed for. But once you start making anything big, it becomes hard to keep track of. That's why language modifications like CoffeeScript, Typescript and Dart have emerged.

As noted by spinon, these programming languages were used in very different ways. Python is a general scripting language, which can sometimes be used to do server-side work. Javascript used to be solely used for building interactivity on web pages. Nowadays, however, it also becomes popular in server-side and desktop applications as Node.js.


Solution:2

The two are generally used quite differently. Javascript is primarily used as a client side scripting language vs python which is a server based language. So in a website you could use both. But not sure if this is what you were wondering.


Solution:3

The key fact is that Javascript is very hard to ever change (because of billions of old implementations existing in browsers), so design errors made in early (and frantically hurried;-) stages are still with the language today. (See Crockford's Javascript: the good parts for a reasonable discussion by a JS expert and enthusiast about the good and bad parts thereof). This might change if something like a use strict; directive ever makes its way into ECMAscript (though programming in ways that support old, and often buggy, browsers, will still be like pulling teeth -- like writing Python code that runs unchanged all the way from Python 1.0 to 3.1 would be!-).

Python is deployed in more traditional ways, so gradual language changes have enhanced it over the years (it was also designed with less hurry, and [[arguably, not "a fact";-)]] ended up with a better design from the start, in many respects).

As a result, Javascript (so far) has not enjoyed much success "server side", where programmers get a choice (even though they still have to use JS for "browser side" code). But there's nothing intrinsic to that. JS is by far the most widely deployed language in the world (those billions of browsers...), huge investments are made in it by many companies and open source groups in competing implementations and supporting frameworks (Python's no slouch at that either, but the difference is still there), practical improvements (speed, warnings) keep piling up on JS's side as a consequence (even though the language proper can't improve).

With strict self-imposed programming discipline (enforced e.g. by Crockfor's "lint" program for JS) and a good supporting framework (jQuery, Dojo, Closure, ...) and tools (Firefox has maybe the best add-ons for JS tracing and debugging, but other browsers are rushing in that direction too), JS has become usable in recent years. Probably one of these days a fast server-side implementation (probably with "use strict;" or the like enforced, once that's officially blessed;-) will start gaining a substantial foothold, just because so many web programmers already have some JS knowledge (they have to, to make good web apps).

Note that much of JS's bad rep (beyond the acknowledge "bad parts that can't be removed";-) comes from stuff that doesn't really "belong" to JS as a language: buggy implementations, the mess that the HTML DOM can often be (esp. with buggy browser impementations), etc. There is no reason a future server-side deployment should reproduce these maddening defects!-)


Solution:4

Python’s a good second language to learn after JavaScript, as they have a reasonable number of similarities, e.g.

  • they’re both memory-managed
  • they have similar data structures â€" JavaScript’s objects and arrays are much like Python’s dictionaries and arrays
  • they’re both used quite a lot for web-related work â€" JavaScript in the browser and in server-side contexts like node.js, Python in web frameworks like Django.

However, Python’s object-oriented... stuff is quite different to JavaScript’s protoype-based object-oriented stuff.

If the only programming you do is manipulating web pages within the web browser, then Python won’t be of any direct use to you (only JavaScript runs in browsers at the moment). But learning another programming language generally gives you new ways to think about the languages you already know. Learning Python could help you write better JavaScript.


Solution:5

JavaScript is usually used as a client-side scripting language - that is, it gets downloaded and executed by your browser. Python, however, is usually not coupled to the web. it can be used as a server-side scripting language, and for scripts and applications of any kind. But it is not a client-side language, and is therefore not directly comparable to Javascript, which has an entirely different audience.

Looking at the language level, Javascript is terrible and dysfunctional (hard to debug, clumsy object-orientation) while Python is beautiful and expressive. This is, of course, subjective :-)


Solution:6

Javascript is primarily for client-side ( browser ), Python is primarily used for server-side - so they serve different needs ( disregarding the Python to JS converters and all ).

I would recommend learning Python though, as it influenced ECMAScript and the syntax is very similar, both are object oriented, both are great languages.

2018 Update: I would still recommend learning Python over Javascript as a first language because it's just that much of a more beautiful, elegant language... although Javascript can now be used for both server-side and client-side thanks to node.js thus making it more useful all-around.

http://hg.toolness.com/python-for-js-programmers/raw-file/tip/PythonForJsProgrammers.html


Solution:7

IMO Python may be easier to learn (having taught both to intro classes).

Also, one major annoyance of JavaScript is that in runs in your browser. This inherently makes it much harder to debug problems.

In terms of a production-level language, Python is more of a general purpose programming language, while JavaScript is targeted at building dynamic web applications.

If you want to get into programming, you should definitely learn a more general purpose language such as Java or Python.


Solution:8

For what purpose? Javascript is king in some circles (web development, for instance).

Javascript and Python are not mutually exclusive. Why not learn both?


Solution:9

JavaScript and Python are both great languages that are geared toward different problems.

JavaScript knowledge is invaluable when dealing with the web, writing web pages, and poking around in html DOM.

Python is a scripting language that is great for a host of things on any machine.


Solution:10

It depends.

Do you want to program in a language that specifically targets web browsers? Stick with Javascript

Do you want to write... well anything besides for web browsers? Learn Python.

Python is an excellent beginner language that's not just a beginner language. Google uses it, NASA uses it, and many, many other organizations use Python.


Solution:11

Along with Python generally being server-side and JavaScript client-side, Python was designed to not only be easy to learn, but also easy to read, and to encourage a more productive environment.


Solution:12

If you need to ask, then I would say no since you don't have a need in mind for its usage.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »