def isValidVariableName(name):
 if (not name):
  return (False, "Variables cannot be missing, None, or ''")
 if (not (type(name) in (str, unicode, numpy.string_, numpy.unicode_))):
  return (False, 'Variables must be string-like')
 try:
  name = str(name)
 except Exception:
  if (type(name) in [unicode, numpy.unicode_]):
   msg = 'name %s (type %s) contains non-ASCII characters (e.g. accents)'
   raise AttributeError((msg % (name, type(name))))
  else:
   msg = 'name %s (type %s) could not be converted to a string'
   raise AttributeError((msg % (name, type(name))))
 if name[0].isdigit():
  return (False, 'Variables cannot begin with numeric character')
 if _nonalphanumeric_re.search(name):
  return (False, 'Variables cannot contain punctuation or spaces')
 return (True, '')

def isValidVariableName ( name ) : if ( not name ) : return ( False , "Variables cannot be missing, None, or ''" ) if ( not ( type ( name ) in ( str , unicode , numpy . string_ , numpy . unicode_ ) ) ) : return ( False , 'Variables must be string-like' ) try : name = str ( name ) except Exception : if ( type ( name ) in [ unicode , numpy . unicode_ ] ) : msg = 'name %s (type %s) contains non-ASCII characters (e.g. accents)' raise AttributeError ( ( msg % ( name , type ( name ) ) ) ) else : msg = 'name %s (type %s) could not be converted to a string' raise AttributeError ( ( msg % ( name , type ( name ) ) ) ) if name [ 0 ] . isdigit ( ) : return ( False , 'Variables cannot begin with numeric character' ) if _nonalphanumeric_re . search ( name ) : return ( False , 'Variables cannot contain punctuation or spaces' ) return ( True , '' )
checks whether a certain string could be used as a valid variable .