Le 09/06/2018 à 12:33, Andrew Svetlov a écrit : > If we consistently apply the idea of hook for internal python structure > modification too many things should be changed. Import > machinery, tracemalloc, profilers/tracers, name it. > If your code (I still don't see the real-life example) wants to check a > policy change -- just do it. > > # on initialization > policy = asyncio.get_event_loop_policy() > > # somewhere in code > if policy is not asyncio.get_event_loop_policy(): > raise RuntimeError("Policy was changed")
You need to repeat this check everywhere because nothing guaranty a code hasn't change it after the check. While a call back allow you to catch it every time. You can set either raise, warn, monkey patch, disable features, etc. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/