On 13/09/2019 14:32, Vinay Sharma via Python-ideas wrote:
As you said there can be lot of possible use cases for the proposed feature, since there are lot’s of use cases for a lock. I can tell you some cases which I am facing.
I don't in principle object to having language support for tricky operations, but I'm a bit concerned that you haven't really defined what atomic types are. I'm worried that you are trying to make something that is still hard look easy, and a lot of naive users will fall for it. I have much the same concern about atomic simple types in C, if it's any comfort.
Let’s say I have a parent process which spawns lots of worker processes to serve some requests. Now the parent process wants to know the statistics about the kind of requests being served by these workers. For, example the average time to serve a request by all workers combined, number of bad requests, number of stalled requests, number of rerouted requests, etc. Now, the worker processes will make updates to these variables, which the parent can report, and accordingly adjust workers. And, instead of locking, it would be much more helpful and easier to use atomic values.
It could be. It could also be completely the wrong answer if you care about having a consistent set of variables for any given task, or a consistent set of variables across all tasks, or any number of other possibilities. This is the kind of attractive cock-up that worries me, I must admit.
-- Rhodri James *-* Kynesim Ltd _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6TRS7HJRUSTFA7DNLPVU74USEWZA62JB/ Code of Conduct: http://python.org/psf/codeofconduct/