def requires_partial(expr):
 if (not isinstance(expr.free_symbols, collections.Iterable)):
  return (len(set(expr.variables)) > 1)
 return (sum(((not s.is_integer) for s in expr.free_symbols)) > 1)

def requires_partial ( expr ) : if ( not isinstance ( expr . free_symbols , collections . Iterable ) ) : return ( len ( set ( expr . variables ) ) > 1 ) return ( sum ( ( ( not s . is_integer ) for s in expr . free_symbols ) ) > 1 )
return whether a partial derivative symbol is required for printing this requires checking how many free variables there are .