Have you considered Custodians, a-la racket? I suspect that adding resources to and finalising custodians requires less defensiveness than marking all iterables as resources, but I've yet to see someone implement them in python.
https://docs.racket-lang.org/reference/custodians.html -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev