def get_argnames(func):
 if six.PY2:
  if isinstance(func, functools.partial):
   spec = inspect.getargspec(func.func)
  elif inspect.isroutine(func):
   spec = inspect.getargspec(func)
  else:
   spec = inspect.getargspec(func.__call__)
  args = [arg for arg in spec.args if (arg != 'self')]
 else:
  sig = inspect.signature(func)
  args = [param.name for param in sig.parameters.values() if (param.kind not in (inspect.Parameter.VAR_POSITIONAL, inspect.Parameter.VAR_KEYWORD))]
 return args

def get_argnames ( func ) : if six . PY2 : if isinstance ( func , functools . partial ) : spec = inspect . getargspec ( func . func ) elif inspect . isroutine ( func ) : spec = inspect . getargspec ( func ) else : spec = inspect . getargspec ( func . __call__ ) args = [ arg for arg in spec . args if ( arg != 'self' ) ] else : sig = inspect . signature ( func ) args = [ param . name for param in sig . parameters . values ( ) if ( param . kind not in ( inspect . Parameter . VAR_POSITIONAL , inspect . Parameter . VAR_KEYWORD ) ) ] return args
introspecs the arguments of a callable .