4,687 karma · joined Dec 4, 2021 (4y ago) · 1,693 submissions
comment 3y ago · link · parent
In that sense, never updating python again is "free" as well, because it would save the python devs the trouble of changing the interpreter. And yet I think we can all agree that Python benefits from the fact that we no longer use Python 3.5
> and teach the entire Python community how to safely write multi-threaded code
People who don't write threaded code don't need to worry about it. And people who write threaded code in python already need to worry about writing thread-safe code. The GIL doesn't prevent race conditions between individual python instructions.
> Python has the means to do that already
And as outlined above, these means are no suitable replacement for true thread based parallelism.
comment 3y ago · link · parent
...is useless for CPU bound tasks. The event loop uses only one core.
> multiprocessing
...relies on IPC and running actual system processes, both of which have alot more overhead than switching thread context and using shared memory.
> For any use case where the last few percent matter, consider not using Python (which will be much much more significant).
Here is an interesting question: If asyncio and multiprocessing already give us "nearly the same or better performance", then why is "use another language" such a common advice to escape parallelism-problems in Python?
Because, curiously enough, the languages that are usually recommended for this (C, Go, Rust, C++, Java) all implement thread-based parallelism.
comment 3y ago · link · parent
IPC is a PITA, and orchestrating processes is even worse.
> or at the isolated numeric library level
Not everything I want to parallelise in python runs in numpy. Simple example: WebService Backends. I have a 64 core server running a Werkzeug/Gunicorn application. The Service is mostly doing CPU bound tasks (data aggregation and analysis), so asyncio is pointless.
What happens is, it runs 60 worker processes. Which puts hefty limitations on any crosstalk and data sharing, because these either require IPC, or using redis/sql. Which are nowhere near as performant as actually shared memory would be.
comment 3y ago · link · parent
The number crunching does, but distributing the workload, receiving results, storing and retreiving data, etc. doesn't. And these are huge losses in performance that could be avoided if we could parallelise them.
comment 3y ago · link · parent
1. Because asyncio is completely useless when the problem is CPU bound, as the event loop still runs only on a single core. As the name implies, it is really only helpful when problems are IO bound.
2. Because sharing data between multiple processes is a giant PITA. Controlling data AND orchestrating processes is an even bigger pain.
3. Processes are expensive, and due to the aforementioned pain of sharing data, greenlets are not really a viable solutions.
comment 3y ago · link · parent
> “but now I have to rewrite my library because some people might use it in non-GIL mode”.
Yes, if library maintainers want their library to remain relevant, they will need to accomodate what the languages developer community uses. This is true for all languages. If they don't want to, that's okay, the community will come up with new libraries.
> the committee making these decisions gives zero ducks about the impact this will have
If they were giving zero ducks, they wouldn't make it backwards compatible, nor would there be a command line option to control the behavior.
>Pypi has what, 500k projects on it? Many abandoned. > >Whom exactly is going to update those?
Languages that base decisions on the update behavior, or lack thereof, of library maintainers, effectively freeze themselves.
And why exactly is the update behavior of abandoned packages a problem? They are abandoned anyway.
> Like, sure… it’s a good change for many people… once all the hard work is done by the community.
The people who want to get rid of the GIL are part of the Python development community. Many of them are library developers themselves.
comment 3y ago · link · parent
Testing the difference between running it with and without `nogil` without having to install 2 different interpreters.
Testing libraries during transitions.
Simply giving users a choice.
Convenience.
Almost no one uses pre-Go.1.11 (GOPATH instead of Modules) any more for project organisation, and the transition is trivially easy. And yet, the toolchain still reacts to `GO111MODULE=off`.
comment 3y ago · link · parent
Poster is not the one answers are for. Answers are for everyone who stumbles upon this question in the future, and the general topic of the question is very much about parsing some HTML with regex.
Again: SO != Help FOrum
> but there likely is a correct way to do it with a hammer.
No, there isn't. Because the correct way is to use a screwdriver. There is certainly a way to do it with a hammer, same as there is a way to write a webserver in brainf__k. Doesn't mean that way is good or should be done.
> Sorry to be blunt, but having coworkers like you make the job really annoying.
Bluntness is fine. I will be blunt as well: Having to fix code full of hammers used to tighten screws is a lot more annoying than having colleagues who try to prevent a codebase full of hammers in the first place.
comment 3y ago · link · parent
True, but that logic goes both ways: Unless told otherwise, whoever reads the question, isn't required to assume that there is a constraint.
If I get asked how to water plants with a sieve, without getting told why getting a watering can is impossible, "You don't, use a watering can", is a perfectly acceptable answer.
Especially when the question is aked in a question archive, rather than a help-forum.
If specific constraints apply to a question, then they should be a part of the question.
comment 3y ago · link · parent
Yes, and they are factually correct in doing so. The correct answer to the question: "How do I use a hammer to tighten a screw" isn't a lengthy description of how to perform some magic with a hammer. The correct answer is: "You don't. Use a screwdriver."
HTML isn't parseable with regex. The various answers under the question explain in great detail why [1] that is the case.
SO isn't a help forum, it's a question archive. The purpose of an answer isn't to solve one guys specific question, but to provide an answer that is useful to all people who ever stumble upon this question.
comment 3y ago · link · parent
The problem with that approach is: It inevitably leads to stagnation.
If all I do is build practical stuff from what exists, I will get very big, very efficient, very impressive steam engines.
But I will never arrive at an internal combustion engine.
Because that requires exploring another path that, in the beginning, and probably for quite some time, will be less efficient compared to my best steam engines.
comment 3y ago · link · parent
No, we really didn't.
Generics were acceptable to the community only because they are fully backwards compatible with existing code, and can be safely ignored if you don't need them.
Which, not at all surprising, is what most golang code still does. Because as it turns out, outside of "collections" of one sort or another, practical use cases for generics are not that easy to find. Most code written never gets to see more than one type to begin with, and more than 2 is already a stretch.
If anything, the addition of generics showcased to the larger community, how little many of the vaunted features!!!!! that people keep demanding and labeling as "essential" are actually needed for a widely accepted and excellent language.
comment 3y ago · link · parent
But that doesn't mean the setup makes sense, and that is exactly my point.
And long term, this has an impact. For example, vertebrate brain size is limited by the simple factor, that we have to put all the connections on the outside. The more neuronal bodies we have, the more connections they require.
N <---> N
In this clumsy diagram, 2 neurons talk with the connections on the inside. However, vertebrate brains have to do this instead: +--------------+
| |
+-> N N <-+
It's easy to see how the second setup becomes prohibitive when more Neurons are added to it. The brains of Protostomia again don't have that problem...they can have the connections on the inside, and the neuron bodies on the outside, aka. the logical setup.Now there are ways around that, eg. Reptile and Bird brains grow in bulbs that theoretically allow sustained growth without the connective layer getting in the way. But similar to the reflective layer in our eyes, this is not a setup that's there because it makes a lot of sense...it's a hack, a workaround for some "legacy system", that is now so enmeshed, it's impossible to change.
comment 3y ago · link · parent
Lefthand is a vertebrate eye, righthand is a squids eye.
In Vertebrates (really in all Chordata), the light sensitive "tips" of the sensory cells point inwards, aka. the exact wrong direction. At the base of the cells are the axons (nerve connections) which transmit the information into the brain.
Due to the aforementioned orientation, these axons run along the outer layer of our light sensitive cells, and at some point have to travel "invards" towards the brain. At that point there can be no cell bodies, and that's the "visual blind spot" of our eyes.
A squids eye doesn't have that problem; all the light sensitive cells point outwards, the axons are at the innermost layer, and connectivity can be achieved without a blind spot (also, they don't need a reflective layer).
comment 3y ago · link · parent
Not even a slight itch.
What do I care how many people use the thing I do? The only thing that matters to me is how good the toys I get to use are.
> See over there, in that one space, you're a weakling.
A lot more people eat fast food that gourmet food. I wonder if the people who can afford gourmet food feel like weaklings because of that. My guess is: No they don't.
comment 3y ago · link · parent
Yes, I am sure about that, because I used to study Biology before going into IT. And we had a lovely lecture in which we used to discuss theoretical setups for lifeforms at a molecular level.
2 nucleotide DNA isn't necessarily less stable. AT-rich domains have less bindings, but if stablity is the issue, use CG instead (3 bindings)...although that is also a compromise, because then opening DNA for transcription gets more difficult.
> your answer is just a hypothesis, not a proof.
My answer is what we observe in evolutionary biology.
I have given an example outside of the molecular world for a reason. There is no real advantage to the inversion of the neural architecture in Chordata, it just didn't matter when the neural tube formation mechanisms came to be. Now, with mammals having huge brains and complex sensory organs, the warts in that design show.
The proof for that is easy to come by, (also a reason btw. why the neural inversion is my favorite example for this): Look an any Protostomia. Their neural system isn't inverted. Consequently, Squids don't have a visual blind spot.