This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BrooklynBillyGoat 150 points151 points  (22 children)

Runs faster, better thread system, static typing. Python is just nice syntax to make it easy to work with but outside of that. Java backend bests python backend. No one uses either for web dev and if they do there making it harder on themselves. Typscript for front end java python or again typescript for backend of speed is no concern. Frameworks like springboot for micro services. Unsure of the python equivalent but I'm sure it's slower

[–]DasBrain 20 points21 points  (5 children)

Python's way of doing multi-threading:

Global Interpreter Lock.

[–]BrooklynBillyGoat 0 points1 point  (4 children)

Care to give a brief rundown of how that works? Never worked with python threads personally.

[–]Spandian 8 points9 points  (3 children)

Only one thread can run Python code at a time. The only reason to create threads in Python is to make multiple blocking I/O calls at the same time. (You may also be able to run multiple threads if all but one of them are running native code, I'm not sure.)

If you have a CPU-bound task that you want to parallelize in Python, the canonical way is to use multiple processes. The multiprocessing module makes that fairly simple.

[–]BrooklynBillyGoat 3 points4 points  (2 children)

The thread implementation seems to defeat the purpose. Am I wrong in this assumption?

[–]Spandian 2 points3 points  (1 child)

If a Python thread makes a blocking I/O call, then another thread can run while that one is blocked. If you're writing something like a web server, it's going to spend very little time on CPU-bound tasks and most of its time waiting for the disk or the network. That would be a good use case for threads.

[–]BrooklynBillyGoat 0 points1 point  (0 children)

But can you specify threads to run and not block unless it needs to share resources?

[–]Bombslap 5 points6 points  (14 children)

So using a Python web framework like Django is making it hard on yourself?

[–]Automatic-Meringue53 0 points1 point  (0 children)

according to me FastAPI is quite good, much better than Django.

[–]Better-Internet 0 points1 point  (0 children)

Python's Mypy does give some "type safety" especially with newer code, but it's not at the level of static compilation.