Comment on How many lines of Java would this take?Comments−jashkenas16yIn CoffeeScript, it's a few lines less: has_methods: (obj, meth_names) -> name for name in meth_names when obj[name] and obj[name].call−rudd16yIt'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)−ighostOP16yTechnically it's one line without semicolons in Python
Comments
In CoffeeScript, it's a few lines less:
It's actually the same length in Python. Just take out the extra line breaks from the gist:
Technically it's one line without semicolons in Python