[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 18 19:40:12 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1094

--- Comment #163 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Dmitry Selyutin from comment #161)
> (In reply to Jacob Lifshay from comment #159)
> > (In reply to Dmitry Selyutin from comment #157)
> > > Funny. Classes are callables. Thing turns out to be simpler.
> > 
> > except calling classes doesn't do what we want here, which is to check if
> > the passed in value is an instance of the class, instead of attempting to
> > construct a new instance of that class.
> 
> Jacob, of course I know that.

yeah, people occasionally forget.

> My point is that I can just check callable
> upon Hook instantiation and raise a ValueError if it's not callable.

that works, though it may be better to do:
def hook(cond):
    if isinstance(cond, type):
        def cond(ty, __class=cond):
            return issubtype(ty, __class)
    if not callable(cond):
        raise TypeError
    ...

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list