JavaScript vs Python: What's the Difference?

preview_player
Показать описание
I've often come across comparisons between different programming languages, and one that always seems to surface is the debate of JavaScript versus Python. Today, I'd like to dive into these two languages and explore their core philosophical differences.

🎓 Courses:

👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!

Social channels:

👀 Code reviewers:
- Yoriz
- Ryan Laursen
- Dale Hagglund

🔖 Chapters:
0:00 Intro
0:35 History and syntax
1:22 Object-oriented programming
2:38 How quickly can you get started?
4:49 Multithreading
5:45 Type system
8:12 Type annotations
10:01 Final thoughts

#arjancodes #softwaredesign #python

DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Рекомендации по теме
Комментарии
Автор

one is an awesome, well thought out, well designed programming language --- the other is javascript

firstname
Автор

Hey Arjan, thanks for the great content as always! Ive got a recommendation for a video series, a 2 parter where in the first video you pose a challenge and in the second reveal a solution. Honestly, one of the biggest hinderances in my journey learning python is having something to code, i would greatly appreciate content like this if it is doable!

auraphonic
Автор

Type hints in python is super great for making the IDE work more smoothly.

haxwithaxe
Автор

You took some shots at Javascript's deployment process there lol. There's really nothing stopping you from installing Nodejs + any editor and being able to develop almost anything you want with just that. Extra goodies (might) require more setup but that's not much different from other languages.

Gigusx
Автор

With reference to your intro joke can I just say I've been stuck in PHP centred jobs for something like 25 years now... and two of my favourite programming channels are yours and Matt Pocock's... One that covers Python and one that covers TypeScript. That's how much I love PHP.

edgeeffect
Автор

Nice one. This is an "essential" comparison -- i.e. a comparison focusing on the essence of each language. Probably the best language vs language comparison I've come across. I would even say this is essential viewing for the (casual) polyglot like myself :)

djl
Автор

I get the desire to take a cheap shot at js but, honestly, it makes the whole video sound pretty biased towards Python. All you need to do to write a HelloWorld in js is to press F12 in a browser. No frameworks required. Comparing the full web dev stack with simple python scripting is really apples to oranges.

GORBACHEVMA
Автор

Hi Arjan, thank you for nice summary. I think it is fair to mention Mojo when you mentioned TypeScript as super set of JS. It is not quite fair to comparing pure python with TS. :D python typing is build into python. TS is not build into JS. I hope Mojo will be next step up for python community.

TomTrval
Автор

Everyone can open a browser and using the inspect tools we can start typing Javascript syntax right away via the console.
so essentially we only need a browser in order to start writing JS code.

I started my programming journey with Python, but now I love JS as well especially their awesome dataviz libraries...nothing in Python comes close to the flexibility of JS dataviz.

pietraderdetective
Автор

I kinda disagree with the "hard" deployment of python.
You can create packages und pack those into a .whl, while declaring all dependencies.
Then you just can pip install said wheel and pip will install all dependencies for you.

Getting to the .whl can be kinda tricky at times, but when you got it right it's really easy to distribute.
-> developer does the "hard" part of creating the wheel, consumer does the easy pip install

You can even specify entry points in your .whl so after installing it the consumer can run your script/program with a simple cli prompt

Hernell
Автор

There is now Bun JavaScript runtime, this gives a better starting environment as there are many additional features like TypeScript support without installing a package. I have used both and there is a use case for each and like any other programming language, they all fail to be the best solution for all problems.

jfftck
Автор

Hello Arjan. Thanks for the nice code roast and refactor example.
I have a question: To uphold Law of Demeter, should in test functions, lines "assert game.grid.grid == expected_state " also be refactored into "assert game.raw_grid == expected_state" ?
Also, conceptually notions of "grid" and "state" are mixed, which could be confusing at first glance.

salec
Автор

Great video, you should do a course on Typescript and on how to use type annotations for Python.
It'd be great to see you covering data structures, algorithms and coding challenges in those languages too.

kvelez
Автор

Whether you like Python or JavaScript really depends on your preferences.

I like JavaScript/TypeScript better than Python because
- data structures are just simpler in modern JavaScript if you understand the concept of everything is an object.
- I don't like JavaScript's unawareness of different object types and TypeScript's weirdness with empty object type where it will consider filled object as valid, but Python is not better imo even though it is built into the language, I cannot even declare the exact shape of a dictionary or list and the "Pythonic way" is often run-time duck typing (yuck!) + Python linters aren't very smart about types being passed around, forcing me to write types very verbosely in python.
- I would also say python's decision to use indentation rather than curly braces, and/or/not rather than &&/||/! just worsen the developer experience than improving it.
- You also didn't mention about JSDoc and pydoc. JSDoc can be used for type-hinting but I couldn't get pydoc to work the same way.
- Also probably just me but the difference in what is considered an attribute and an index feels unnecessary.
- working with asynchronous code on python feels unnecessarily complex (with asyncio) when compared to JavaScript's Promise-based async-await.
- And the last one, about backwards-compatibility, where there are so many compilers for JavaScript/TypeScript that allows developers to write any cutting-edge features and compile it to any of the older ECMA standards (for example ES2020 to ES5 to support IE).

Most people still imagine JavaScript as having to live in the browser and slow, where in reality it's very similar to python when in comes to environment since you can use Nodejs, Deno, or Bun instead. Plus despite a lot of people still using jQuery, ES6+ JavaScript is actually already very capable of doing all of the jobs that used to be a pain to do without jQuery. It's the same thing as meme-ing PHP for being slow and bad to develop in, even though a lot of things have changed since PHP 5 (yes, I do like modern PHP).

I feel JavaScript has its pain points (as with every other programming languages) but those are not what are pointed out within your video.

TheDuckPox
Автор

I am going into cloud developer course (AWS). i would like to know which to concentrate on. Python or JavaScript?
Please advise.

JohnJohnson-chxq
Автор

Would be great if you could compare Julia vs Python and Mojo vs Python.

ButchCassidyAndSundanceKid
Автор

Hi Arjan, I was researching the best way for creating a very simple CRUD app using vanilla JS, HTML5, CSS3 & Database (PostgreSQL). Was debating on the simplest solution. Either JS with SQL or Python with SQL. I reached the timeline (2:38 ->++) & hearing what you had to say cleared things up for me quickly. The amount of complexity with JavaScript the way you describe it sounds like a nightmare. Thank you for clearing things up I decided to use Python with SQLite3 and keep my project very simple!

DevlogBill
Автор

3:48 subtitle says "course" instead of "CORS". this might sound pretty deceiving for a beginner imo, maybe it's just me, but I'd expect beginners to find the video and use the subtitles

glorytoarstotzka
Автор

Really appreciate the nod to the difficulties with both languages, I have experience in both, and I believe they both have their own uses. Python for data science projects and quick CICD-related code bases is a no-brainer. Javascript for the web seems to be a no-brainer as well because of the browser connotation and everything being JS on the front-end EOD anyway.

Wish you did more targeted examples of what FLASK vs ... or REACT vs... or things of that nature, as the libraries are ultimately what give JS or PY their real advantage imho.

internetrush
Автор

Hi Arjan, thanks again for your sound minded comment on these prevelant programming languages. As Javascript runs on most things it has to take at least some of our mind share, regardless how some may wish for other things that are 'better' to take its place. Python was something I avoided previous to Y2K due to its having 'tabs' rather than { } brackets. I was so different a person back then. Your comments around the amount of effort required to get things working with JS is very poignant and it made me think of fireship and others who liken this sort of thing to 'Stockholm syndrome' in that we are held captive to a situation and go on to 'like' the jumps and hoops we have to go through just to get started, let alone to get the job done. Tooling is key I think and picking the right tools is crtical to succeding, in particluar with JS.

JonBrookes