Did you know that Python was named after Monty Python?
One of the world’s most popular coding languages, Python was first conceptualized in the la...
For further actions, you may consider blocking this person and/or reporting abuse
Great write up! Could you elaborate on what you mean by Python not having "true" multiprocessor support?
Python has what is called the "Global Interpreter Lock", you can read more here: docs.python.org/3/c-api/init.html#...
Meaning that when you launch multiple threads in the same python interpreter they are actually locked on one core and can't be really parallelized. For some applications it's not a real issue, when your threads spend most of the time sleeping/waiting for IO for example. But when you need real parallel computing on multiple cores you can't do it with threads.
Python provides the "multiprocessing" module to workaround this, launching code in separate processes. It makes it a bit harder but not impossible to do real multi core parallelization.
Thanks for your explanation! So if I'm understanding correctly the only real way to do parallel processing is to have multiple python processes separate from each other. But that means the data used by each process is sort of isolated, right?
Yes, the multiprocessing module provides some tools to exchange this data: docs.python.org/2/library/multipro... but your data needs to be easily serializable which is not always the case.
@antontsvil , I personally think the article is a bit misleading becuase it mixes different details under umbrella terms but @loki already explained what's going on in Python :)
I'm pretty sure that the meaning of this is that Python doesn't handle this stuff well - dealing with it is a pain. I would love Python to the end of time if it just had multithreading that worked.
A couple of notes right from the start:
Python was opensource since the first public release, not since version 2.0, its first public version was in February 1991.
Instagram has around a billion daily active users, not 4 million.
This is misleading. Async programming is hard, please don't go around tell people that concurrency is easy eheh. asyncio is a great step forward (asyncore and asynchat in Python 2 were truly horrible) but it's common knowledge that it is not that easy. Which is also the reason they are wrappers on top of it and different approaches like trio to try to make programmers lives easier.
I think this sentence is detrimental for a beginner. There's no explanation, just a "yeah you can do it but it's not great". In strict terms Python has multiprocessing support that can have an easy to use interface, I even wrote an article about here on DEV: How to make Python code concurrent with 3 lines.
I'm sure you're referring to something specific but this sentence instills doubt in people without actually having an explanation for it.
I don't think you meant multithreading instead of multiprocessing, but maybe you did?
There's a difference between "multiprocessing" and "support of multiple processors" (which Python always has through multiprocessing but doesn't have in memory bound situations in multithreading due to the GIL). From docs.python.org/3/library/multipro... The multiprocessing package offers both local and remote concurrency, effectively side-stepping the Global Interpreter Lock by using subprocesses instead of threads. Due to this, the multiprocessing module allows the programmer to fully leverage multiple processors on a given machine. It runs on both Unix and Windows.
I think assertions like this should be clarified in overview articles aimed at beginners. As a seasoned developer I have a likely idea of what you mean (the fact that concurrency is not a language construct but it's done through libraries?), but I'm honestly not even sure about that.
Hello I am beginner of python
Your writing is Great for me
I am going to make the e-commerece site using the python/Django
what do you think about its?
The Django is suitable to make the shoping site?
If you have some comment, please let me know
I really enjoyed reading your article. I’d agree on most points there and also learned a few interesting new things. BTW, our team have also written on a similar topic. I think your readers might benefit from checking it out: softformance.com/blog/python-progr...
Very informative for a newbie