def varnames(func, startindex=None):
 cache = getattr(func, '__dict__', {})
 try:
  return cache['_varnames']
 except KeyError:
  pass
 if inspect.isclass(func):
  try:
   func = func.__init__
  except AttributeError:
   return ()
  startindex = 1
 else:
  if ((not inspect.isfunction(func)) and (not inspect.ismethod(func))):
   try:
    func = getattr(func, '__call__', func)
   except Exception:
    return ()
  if (startindex is None):
   startindex = int(inspect.ismethod(func))
 try:
  rawcode = func.__code__
 except AttributeError:
  return ()
 try:
  x = rawcode.co_varnames[startindex:rawcode.co_argcount]
 except AttributeError:
  x = ()
 else:
  defaults = func.__defaults__
  if defaults:
   x = x[:(- len(defaults))]
 try:
  cache['_varnames'] = x
 except TypeError:
  pass
 return x

def varnames ( func , startindex = None ) : cache = getattr ( func , '__dict__' , { } ) try : return cache [ '_varnames' ] except KeyError : pass if inspect . isclass ( func ) : try : func = func . __init__ except AttributeError : return ( ) startindex = 1 else : if ( ( not inspect . isfunction ( func ) ) and ( not inspect . ismethod ( func ) ) ) : try : func = getattr ( func , '__call__' , func ) except Exception : return ( ) if ( startindex is None ) : startindex = int ( inspect . ismethod ( func ) ) try : rawcode = func . __code__ except AttributeError : return ( ) try : x = rawcode . co_varnames [ startindex : rawcode . co_argcount ] except AttributeError : x = ( ) else : defaults = func . __defaults__ if defaults : x = x [ : ( - len ( defaults ) ) ] try : cache [ '_varnames' ] = x except TypeError : pass return x
return argument name tuple for a function .