[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Fri Jun 23 08:55:48 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #232 from Dmitry Selyutin <ghostmansd at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #231)
>
> yeah it's really short. suggestion, initialise index to 0
> then increment *after* the yield. set to -1 then increment
> before is counter-intuitive.
I chose -1 as an alternative to accessing (index - 1). But both approaches are
somewhat annoying. The thing is that _all_ code in parent is called _before_
child's code. Here's how it looks simplified:
for (node, *) in walk(nodes): # recursively
node.__enter__()
node.code()
node.__exit__()
If we iterate over some child node, we've already called __enter__ and __exit__
for its parent. Frankly I'm not sure how to circumvent this. I like the
semantic you assumed, though. This would kinda be similar to `for` + `with`
combined.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list