[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Mon Jun 19 21:08:07 BST 2023
https://bugs.libre-soc.org/show_bug.cgi?id=1094
--- Comment #185 from Dmitry Selyutin <ghostmansd at gmail.com> ---
Let's consider the example below:
class Walker(mdis.walker.Walker):
pass
class ContextVisitor(mdis.visitor.ContextVisitor):
@mdis.dispatcher.Hook(object)
@contextlib.contextmanager
def dispatch_object(self, instance, *, path):
print(f"path={path}", instance)
yield instance
walker = Walker()
visitor = ContextVisitor()
items = (
{("a", 1): 3.4, 2: {5, 6}},
)
for (item, path) in walker(items):
with visitor(item, path=path):
pass
With the recent update (not yet pushed), here's what I get:
path=[0] {('a', 1): 3.4, 2: {5, 6}}
path=[0, ('a', 1)] 3.4
path=[0, 2] {5, 6}
path=[0, 2, 5] 5
path=[0, 2, 6] 6
Jacob, that's less than you posted, because I didn't handle the dict_items
specifically. This seems excessive, since dict_items is not actually accessible
via items[0][0]. And, to be honest, yielding the element itself in
set/frozenset doesn't look valid either; None perhaps? But None in the middle
is strange too.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list