On Wed, Oct 21, 2015 at 10:10:56AM -0700, Ethan Furman wrote: > On 10/21/2015 08:53 AM, Random832 wrote: > > >If a pure python class can cause a reference leak, doesn't that mean it > >is only a symptom rather than the real cause? Or is it that the use of > >@object.__new__ is considered "too clever" to be worth fixing? > > Where can I find out more about using `object.__new__` as a decorator?
How about the interactive interpreter? py> @object.__new__ ... class X: ... pass ... py> X <__main__.X object at 0xb7b4dacc> Consider the pre-decorator-syntax way of writing that: class X: pass X = object.__new__(X) That's a way of setting X = X(), except that it only works for X a class (can't decorate a function this way), and it avoids calling the __init__ method. -- Steve _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com