[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: Proposal: Deterministic Object Destruction

On Thursday, March 1, 2018 at 1:54:40 AM UTC-6, Serhiy Storchaka wrote:
> Every global function (or method of global class) creates a
> reference cycle.
>      def f(): pass
>      f.__globals__['f'] is f

(Note: This is also a response to dieter)

This is true, but it does not answer the challenge directly
because function CRs are a consequence of Python _internals_
*NOT* consequences of a custom class written by a programmer
which references itself _explicitly_.

Remember, the challenge is _not_ simply a matter of circular
references (there is literally tons of Python code out there
which creates CRs for various reasons), no, the challenge is
to create a custom class which references _itself_, and then
explain (or demonstrate) how such a thing serves a practical

@Steven. Whilst your "list that appends itself" was very
clever, it only indirectly answered the challenge. So if you
want the gold metal, i need to see a _direct_ solution for
the challenge.