On Tue, Apr 09, 2024 at 12:35:27PM -0700, Collin Funk wrote: > Yes, I see what you mean. I very much prefer the 'moduleFilter' idea. > It would allow us to remove a lot of the repetitive conditionals. Now > I just have to figure out how to do that. If only Python had function > pointers...
It does, since callable objects exist as first class citizens. For example: >>> def foo(): ... print("in foo") ... >>> def bar(): ... print("in bar") ... >>> dispatch = { "foo":foo, "bar":bar } >>> dispatch["foo"]() in foo >>> dispatch["bar"]() in bar -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org