Progress on the Gilectomy
lwn.net
lwn.net
A few restrictions on the language would make it easier, but when this is suggested, Guido has a cow.
- VecPy, for number-crunching.[2]
- Newthreading, which I wrote in 2010.[3]
[1] https://lwn.net/Articles/650489/ [2] https://www.andrew.cmu.edu/user/dfarrow/proposal.html [3] http://www.animats.com/papers/languages/newthreadingintro.ht...
Still, if you were going to propose "a few restrictions on the language" to make it less dynamic and easier to do multi-threading / optimization, what would they look like?
Like what?
My first reaction is to think "and he's [probably] right!"
Python's added value is it's very rich and flexible object model. Imposing restrictions on the object model is robbing Peter to pay Paul in an environment where Peter is more important, albeit for historical reasons.
For boring old web development and business processing, the GIL seems to be a very efficient way of utilizing a CPU+caches without resorting to the horrible event-driven programming model of Node. Want twice the throughput? Run twice the processes. I kinda wish Java would bring back the option of green threads, it was a perfect programming model for web development.
It would be nicer if instead of trying to turn python into something it is not (a language for writing CPU intensive tasks), it was made better at what it is (glue code).
It would be especially nice if there were tighter, more seamless integration between python and rust so that hot paths in python can easily be migrated to rust.
Ah yes, let's not focus on something python is not. Let's appeal to the majority use case.
What minor planet are people here from?
Yeah, I've tried it and it didn't work.
It's certainly feasible it's just not very well developed.
compare https://doc.rust-lang.org/1.2.0/book/rust-inside-other-langu... to http://usehelix.com/ for example; the former is only using what the language knows, the latter is a nice library built on top.
There's been some effort for nicer Python integration, but I haven't seen anything super super slick yet.
Linux is somewhat smart about it with its copy on write semantics (a double edged sword really). However, the moment you refer to an existing Python object the underlying data-structure gets mutated because of reference counting and boom now you have to copy the whole thing.
This can be worked around with creative stealing and by keeping a sharp lookout for references but it gets really painful and annoying.
Even if that were resolved its still not as flexible as one would want. One cant really go about spawning and terminating process too frequently. This forces one to move larger and larger parts of the logic into C.
That is the real problem. Any sufficiently popular language will inevitably be used in scenarios it is not suited for. Python has now reached that threshold, so all sorts of communities are trying to stretch it and pull it every other way. Sometimes this makes the language better, sometimes it's just a source of complication and frustration.
There is also the issue that some quarters feel python's role is being eroded by newer stuff like golang and nodejs, which were built with high-performance multithreading in mind from the start. I personally think this is not much of a concern (if you are willing to trade python for golang or nodejs, you were not really using python because of its expressiveness and conciseness in the first place), but clearly a lot of people do.
I'd be very curious as to the answer here. Some times you do like the pretty code from something like Python, but you get backed into a performance corner, at least I could see that happening.
Python added the "horrible event-driven programming model of Node" in Python 3.6. The syntax is said to be better, though.
If you have 16 CPUs in your system, seeing your load at 6% for the first 10% an last 10% of running time, and at 100% in-between surely will make people think there must be easy wins in that Python code. More so since many users will have effectively _zero_ knowledge of C.
The compute code for ML is emphatically not written in Python – Python is essentially a lightweight API wrapper around it.
Agreed that compute code for ML is not written in Python, but if GIL wasn't a problem there would be one less reason to drop down to C. Many users would appreciate that. Cython helps with the C part but to a degree.
Has it? Why the assumption that Go is a direct competitor?
My impression is that Go excels where Python does not, and vice-versa. I use both languages a lot for my day-job, and when using Go, I very much miss having an interpreter and a fully-interactive debugger (Delve is excellent considering the limitations imposed by Go, but much less flexible than pdb).
And let's not even talk about metaprogramming...
>We had anticipated interest from C, C++, and Java programmers, but the flurry of interest from users of dynamically-typed languages like Python and JavaScript was unexpected.
In my experience, these people are using both languages for the reasons mentioned above.