Skip to content

Comment on How many lines of Java would this take?

Comments

The snippet is imprecise. it should be something like

    def hasmethod(obj, meth_name):
        """If it calls like a method it's a method."""
        
        return callable(getattr(obj, meth_name)) if hasattr(obj, meth_name) else False

This function doesn't implement the same functionality. It doesn't even take the same arguments.

you are quite right. it looks totally different to when i first checked it, so yes, ignore me.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.