[Python-ideas] Deterministic iterator cleanup

Yury Selivanov yselivanov.ml at gmail.com
Wed Oct 19 12:43:42 EDT 2016


On 2016-10-19 12:38 PM, Random832 wrote:
> On Wed, Oct 19, 2016, at 11:51, Yury Selivanov wrote:
>> I'm -1 on the idea.  Here's why:
>>
>>
>> 1. Python is a very dynamic language with GC and that is one of its
>> fundamental properties.  This proposal might make GC of iterators more
>> deterministic, but that is only one case.
> There is a huge difference between wanting deterministic GC and wanting
> cleanup code to be called deterministically. We're not talking about
> memory usage here.
>

I understand, but both topics are closely tied together.  Cleanup code 
can be implemented in some __del__ method of some non-iterator object.  
This proposal doesn't address such cases, it focuses only on iterators.

My point is that it's not worth it to *significantly* change iteration 
(protocols and statements) in Python to only *partially* address the issue.

Yury


More information about the Python-ideas mailing list