On Tue, Jun 20, 2017 at 1:44 AM, Skip Montanaro <skip.montan...@gmail.com> wrote: > On Mon, Jun 19, 2017 at 10:20 AM, Ethan Furman <et...@stoneleaf.us> wrote: > >> Programming at the C level is not working in Python, and many Python >> niceties simply don't exist there. > > > True, but a lot of functionality available to Python programmers exists at > the extension module level, whether delivered as part of the core > distribution or from third-party sources. (The core CPython test suite > spends a fair amount of effort on leak detection, one side effect of > incorrect reference counting.) While programming in Python you don't need > to worry about reference counting errors, when they slip through from the C > level, they affect you.
High level languages mean that you don't have to write C code. Does the presence of core code and/or extension modules written in C mean that Python isn't a high level language? No. And nor does that code mean Python isn't garbage-collected. Everything has to have an implementation somewhere. Or let's look at it a different way. Instead of using a PyObject* in C code, you could write C++ code that uses a trivial wrapper class that holds the pointer, increments its refcount on construction, and decrements that refcount on destruction. That way, you can simply declare these PyObjectWrappers and let them expire. Does that mean that suddenly the refcounting isn't your responsibility, ergo it's now a garbage collector? Because the transformation is trivially easy. ChrisA -- https://mail.python.org/mailman/listinfo/python-list