3 ms·
It's actually the same length in Python. Just take out the extra line breaks from the gist: def hasmethods(obj, *meth_names): return all(hasattr(ge
by rudd 17y ago
It's actually the same length in Python. Just take out the extra line breaks from the gist:
def hasmethods(obj, *meth_names):
return all(hasattr(getattr(obj, m, None), '__call__') for m in meth_names)
- ighost 17y agoTechnically it's one line without semicolons in Python