Hello, On Sun, 6 Jan 2019 17:26:09 +0200 Serhiy Storchaka <storch...@gmail.com> wrote:
[] > Because there is a reason for such code. > > See issue1631942 [1] and the thread with the subject "self-contained > exceptions" on the Python-3000 mailing list [2] for the rationale. > > In short, the code > > try: > 1/0 > except Exception as e: > del e > > should work. (Dark) Magic. Live and learn/think. So, we allow user to delete a var, then recreate it, just to delete again. Thanks for both the hint and references, Serhiy! I can only agree with what Chris wrote in the initial reply - it would nice if there would be an explanation of these tricks somewhere. I myself wouldn't know a better place than the source code comments. Well, at least I did trace it to the source code where it's handled. > I do not see a problem with storing None before deleting a variable. > This is not a performance critical code, because it is executed only > when an exception was raised and caught. >From CPython's points of view, I might (well, have to) agree. But I was pretty surprised/disappointed that MicroPython follows the same routine, I'm glad I now understand ins and outs of the choices made. > > [1] https://bugs.python.org/issue1631942 > [2] > https://mail.python.org/pipermail/python-3000/2007-January/005294.html -- Best regards, Paul mailto:pmis...@gmail.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com