News for hackers. Stuff that matters.
Re:No-GIL mode coming for Python by _flux on Saturday July 29, 2023 @06:08AM (#36918641)
I haven't use Python multiprocessing packages, so I need to ask, how does one do flexible work queues with them?

I mean a situation like where in threaded context there would be code like:

    def determine_quest_latency(quest_name: str) -> int:
        return other_thread.wait_sync_job(lambda context: context.ping_quest(quest_name))
..without needing to provide a protocol that covers each possible scenario the client might wish to execute in the process?

I believe the answer is "you don't", but passing functions in messages is a highly convenient way to structure code in a way that local decisions can stay local, instead of being interspersed around the codebase.

Re:No-GIL mode coming for Python by xmcqdpt2 on Saturday July 29, 2023 @07:37AM (#36919219)
I believe you just pass objects instead, like you would in OOP, and take the hit of pickling and unpickling them every time.

If you really want to pass lambdas, you can use a third party library to pickle them

https://github.com/cloudpipe/cloudpickle

Yes, this is not great.