RFC: Proposal: Deterministic Object Destruction
01.03.18 04:46, Rick Johnson ????:
> On Wednesday, February 28, 2018 at 5:02:17 PM UTC-6, Chris Angelico wrote:
>> Here's one example: reference cycles. When do they get detected?
>> Taking a really simple situation:
>> class Foo:
>> def __init__(self):
>> self.self = self
> Can you provide a real world example in which you need an
> object which circularly references _itself_? This looks like
> a highly contrived example used to (1) merely win the
> argument, and (2) Bump fib() up one position from it's
> current position as "the worst introductory example of how
> to write a function in the history of programming tutorials"
Every global function (or method of global class) creates a reference cycle.
def f(): pass
f.__globals__['f'] is f