News for hackers. Stuff that matters.
Re:Ban 1+N in Django by squeaky-clean on Sunday March 26, 2023 @08:57PM (#35321572)
You could probably implement in in a context manager, have the `__enter__()` method execute the `_DA_get_original, DeferredAttribute.__get__ = DeferredAttribute.__get__, _DeferredAttribute_get` code and have the `__exit__` method undo that re-assignment.

(Or maybe the reverse is better. Ban N+1 by default and the context manager `__enter__` puts back the original assignment, `__exit__` brings back the banned version).

There are no comments on this comment yet.