On 2020-12-31 21:34, Steven D'Aprano wrote:
Is there something we can do to make it easier for people to deal with
recursive data structures, like the list repr and deepcopy code does? Is
there a pattern we can abstract out and provide as a tool or recipe for
people to use in their own code?

It sounds promising but so far a bit too vague for me to understand what you're really suggesting. What form would this "something" take? Are you envisioning, say, a function safe_recursive_iter so that you could do `for item in safe_recursive_iter(obj)` and it would cleanly raise an exception if it wound up recursing through the same object more than once, rather than getting stuck in an infinite loop?

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/ASG6PHMOETWAO7E6GESBMEJZLPH5XF53/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to