Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » js or python
- TheSecondGilbert
-
100+ posts
js or python
Depends on what things you like to code.
JS is good for anything web-related, either in the frontend using the browser itself, or in the backend using something like Node. It's also best for handling things that could happen anytime asynchronously (after all, it's a heavily event-driven language since it's meant to give interaction to HTML elements).
Python is more for general, catch-all situations, like codes that you want write or test quickly.
At least that's how I see them.
JS is good for anything web-related, either in the frontend using the browser itself, or in the backend using something like Node. It's also best for handling things that could happen anytime asynchronously (after all, it's a heavily event-driven language since it's meant to give interaction to HTML elements).
Python is more for general, catch-all situations, like codes that you want write or test quickly.
At least that's how I see them.
- AmazingMech2418
-
1000+ posts
js or python
Both languages really can be used to do anything. Generally, JS is usually faster, but the main difference is how you prefer to program.
If you like indenting, use Python. If you like brackets, use JS. If you like typing more, but making code more readable, Python, if you like shorter, JS. If you like built-in features, JS, if you like external libraries, Python. You can use either in almost any use case (other than web Python, other than Brython), so it's really just down to personal preference…
If you like indenting, use Python. If you like brackets, use JS. If you like typing more, but making code more readable, Python, if you like shorter, JS. If you like built-in features, JS, if you like external libraries, Python. You can use either in almost any use case (other than web Python, other than Brython), so it's really just down to personal preference…
- Chiroyce
-
1000+ posts
js or python
Well If you like built-in features, JS, if you like external libraries, Python. #4 says the opposite, and I agree. You do need external libraries more in JS than Python for doing certain tasks
True. In the end, there isn't one that's better. It's all down to personal preferences.
although python has a package for everything
An important advantage of Python you didn't mention is its standard library – you can do a lot of things without even installing a package. The modules it contains include:
- Text processing
- Working with text encodings and binary data
- Date and time calculations
- Various data structures
- Mathematical operations
- Functional programming
- Working with files
- Serializing Python objects
- SQLite
- Different data compression formats
- Reading and writing CSV and similar file formats
- Parsing command line arguments (although I would recommend using a library for that)
- Log files
- Using functions written in C
- Threads
- Multiprocessing
- Asynchronous I/O (unfortunately not as good as JavaScript promises)
- Networking
- JSON
- Media types
- Base64 encoding and decoding
- HTML
- XML
- Interacting with web browsers
- CGI
- WSGI
- Working with URLs
- HTTP requests (again, a library is recommended instead)
- FTP, IMAP, SMTP etc. protocols
- SMTP servers
- UUIDs
- HTTP servers
- IP addresses
- Working with some media files
- Converting between color systems
- gettext
- Turtle graphics
- Graphical user interfaces (tkinter)
- Working with various language features (e.g. bytecode files)
You would need a library to do most of these things in JavaScript (or implement them yourself).
Last edited by Chiroyce (Oct. 19, 2022 11:28:51)
- CST1229
-
1000+ posts
js or python
I prefer JavaScript - the concept of the amount of whitespace mattering to syntax is kinda weird to me (and also that JavaScript can be used for web development (i know brython exists btw)).
Last edited by CST1229 (Oct. 19, 2022 12:53:37)
- TheGlassPenguin
-
1000+ posts
js or python
Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
- lolecksdeehaha
-
1000+ posts
js or python
Especially Node.js; it's way more efficient than Python in performance. Also, I just like the fact that I don't need to enter a long command to install stuff as npm just mostly handles everything (if you have it installed). In my Python experience, it's been hard to read and it seems to need a long command to install a package like PyGame. Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
If you don't like undefined and null, and all the stuff that Python errors on, you could try TS (& node.ts) and Strict Mode (esm).
- TheGlassPenguin
-
1000+ posts
js or python
forget node.js i use vanilla javascriptEspecially Node.js; Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
- TCK_Official
-
32 posts
js or python
In my opinion, JS is more “practical” for general use. It has many different applications, and every developer will at least tamper around with it at some point. It is a good skill to learn.
Python, on the other hand, is less practical than JS. You can't make a lot with it, and you need different packages and dependencies to do much anything with it besides coding for fun. It's extremely simple and any good developer can learn it within a few days of dedicating time to it, I learned it within two days myself.
But then, there are also other languages that are more practical than both JS and Python. Languages like C++, C#, and more have much more practical use in the real world.
Python, on the other hand, is less practical than JS. You can't make a lot with it, and you need different packages and dependencies to do much anything with it besides coding for fun. It's extremely simple and any good developer can learn it within a few days of dedicating time to it, I learned it within two days myself.
But then, there are also other languages that are more practical than both JS and Python. Languages like C++, C#, and more have much more practical use in the real world.
- imfh
-
1000+ posts
js or python
Long command? For Python, you just have to run “pip3 install pygame.” For npm, you have to either add an extra parameter or edit the package.json before running npm install. Yarn is better in that respect, but “yarn add” is still not short enough to call “pip3 install” long.Especially Node.js; it's way more efficient than Python in performance. Also, I just like the fact that I don't need to enter a long command to install stuff as npm just mostly handles everything (if you have it installed). In my Python experience, it's been hard to read and it seems to need a long command to install a package like PyGame. Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
If you don't like undefined and null, and all the stuff that Python errors on, you could try TS (& node.ts) and Strict Mode (esm).
Like npm, you do need to have pip installed and in your path for this to work.
There are Python variants / extensions which enforce static typing like TS does for JS. Unlike TS, Python with static typing is actually still valid Python.
- AmazingMech2418
-
1000+ posts
js or python
You might not have to install a package for Python, but you still have to import the module… Also, a lot of these can be done in JS with its standard library too, so not sure what the issue is…Well If you like built-in features, JS, if you like external libraries, Python. #4 says the opposite, and I agree. You do need external libraries more in JS than Python for doing certain tasksTrue. In the end, there isn't one that's better. It's all down to personal preferences.
although python has a package for everything
An important advantage of Python you didn't mention is its standard library – you can do a lot of things without even installing a package. The modules it contains include:
-snip-
You would need a library to do most of these things in JavaScript (or implement them yourself).
- AmazingMech2418
-
1000+ posts
js or python
You do know that Node is vanilla JS, right? Just a different environment? Vanilla just means no imported libraries or modules or anything…forget node.js i use vanilla javascriptEspecially Node.js; Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
- PPPDUD
-
1000+ posts
js or python
Python. It is strictly typed and is easy to learn, unlike the mess called JS.
- AmazingMech2418
-
1000+ posts
js or python
Python's strict typing has both pros and cons, and JavaScript is just as easy, if not easier, than Python to learn… But like, I personally don't like how strict Python is both with syntax and typing, like with how only explicit type casting is allowed (using str() to cast an int to string, instead of just appending it), or with its forced indentation (and not even allowing one function to use tabs and another to use spaces, which can be a huge pain for collaborative development without changing IDE settings). Python. It is strictly typed and is easy to learn, unlike the mess called JS.
- ISTILLMAKESTUFF
-
500+ posts
js or python
Js, and here are the reasons:
But python has its reasons too:
- More beautiful with all the brackets, curly-brackets, and semicolons
- Syntax based off of C, making it easier to learn languages like cpp, c, java, C#, ruby, and more. If a python programmer tried to learn thesee languages, and saw all the things that make the language beautiful, they would have a heart attach (not really)
- Needs no download, supported by all browsers, meaning people like me can learn and use it
- Have fun developing both backend and frontend with python!
But python has its reasons too:
- There's something called micropython, so you don't have to learn C or C++ to code stuff like arduino
- (I think?) Easier to draw on the output (bc you don't need to set up canvas/webgl)
- ISTILLMAKESTUFF
-
500+ posts
js or python
AYYYYY NOTIN BUT VANILLY MAN!!! WITH YOU ALL THE WAY!forget node.js i use vanilla javascriptEspecially Node.js; Honestly, I'm learning both. all of them seem very useful, Python has an easier syntax but JavaScript is very powerful
- AmazingMech2418
-
1000+ posts
js or python
Just want to point out that Ruby has a more Python-like syntax, but there are many other languages that use brackets, including Swift, Rust, Kotlin, and Go! Many newer languages are transitioning away from as many parentheses, but brackets are definitely staying! Js, and here are the reasons:
- More beautiful with all the brackets, curly-brackets, and semicolons
- Syntax based off of C, making it easier to learn languages like cpp, c, java, C#, ruby, and more. If a python programmer tried to learn thesee languages, and saw all the things that make the language beautiful, they would have a heart attach (not really)
- Needs no download, supported by all browsers, meaning people like me can learn and use it
- Have fun developing both backend and frontend with python!
But python has its reasons too:
- There's something called micropython, so you don't have to learn C or C++ to code stuff like arduino
- (I think?) Easier to draw on the output (bc you don't need to set up canvas/webgl)
Also, you do still need to download Node.js, but yes, you are right, you can use JS in the browser without downloading anything!
Also, technically, Brython does exist for front-end development, and there are also WASM wrappers for it, but they do ultimately compile to JS/WASM anyways, and WASM needs JS to actually run…
And yes, Python is easier to make GUIs with, other than with Canvas/WebGL or DOM. But Node.js still has libraries like Electron, NodeGUI, React Native, and bindings for GTK and QT that still make it feasible to make native GUIs! Both Python and JavaScript have C/C++ interoperability, which means that both languages can do anything, it's just a matter of how easy it is!
- gatgatcode
-
100+ posts
js or python
i use python for a project of mine but yeah. you want to do web stuff? js! want to interact with files? PYTHON! want to interact with scratch? PYTHON!
- AmazingMech2418
-
1000+ posts
js or python
project of mine but yeah. you want to do web stuff? js! want to interact with files? PYTHON! want to interact with scratch? PYTHON!Regarding interacting with Scratch, really any programming language would work! I personally use Node.js for all of mine! A lot of older libraries are outdated with security measures put in place for authentication, so that can be limiting, but it's still not just Python! If you want, feel free to check out i use python for a ScratchCloud for an example of how to do things with JS!
- MagicCrayon9342
-
1000+ posts
js or python
Two languages, two purposes. JavaScript for the web, python for data and stuff
- MagicCrayon9342
-
1000+ posts
js or python
Compiled Languages FTW
Neither JavaScript or Python
Neither JavaScript or Python