logoalt Hacker News

mattipyesterday at 5:32 AM2 repliesview on HN

That cleanup can be explicit when needed by using context managers. Mixing resource handling with object lifetime is a bad design choice


Replies

cpgxiiiyesterday at 3:42 PM

> That cleanup can be explicit when needed by using context managers.

It certainly can be, but if a large part of the Python code you are writing involves native objects exposed through bindings then using context managers everywhere results in an incredible mess.

> Mixing resource handling with object lifetime is a bad design choice

It is a choice made successfully by a number of other high-performance languages/runtimes. Unfortunately for Python-the-language, so much of the utility of Python-the-ecosystem depends on components written in those languages (unlike, for example, JVM or CLR languages where the runtime is usually fast enough to require a fairly small portion of non-managed code).

1718627440yesterday at 12:39 PM

Tell that to the C++ guys...