bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-tool.py: Fix some unbound variables.


From: Eric Blake
Subject: Re: gnulib-tool.py: Fix some unbound variables.
Date: Tue, 9 Apr 2024 15:06:53 -0500
User-agent: NeoMutt/20240201

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]