parameters: (datatype, order)
docstring: Given a datatype and an order object, return a new names tuple, with the
      order indicated
docstring_summary: Given a datatype and an order object, return a new names tuple, with the
      order indicated
docstring_tokens: Given a datatype and an order object return a new names tuple with the order indicated
function: def _newnames(datatype, order):
      """
      Given a datatype and an order object, return a new names tuple, with the
      order indicated
      """
      oldnames = datatype.names
      nameslist = list(oldnames)
      if isinstance(order, (str, unicode)):
          order = [order]
      seen = set()
      if isinstance(order, (list, tuple)):
          for name in order:
              try:
                  nameslist.remove(name)
              except ValueError:
                  if name in seen:
                      raise ValueError("duplicate field name: %s" % (name,))
                  else:
                      raise ValueError("unknown field name: %s" % (name,))
              seen.add(name)
          return tuple(list(order) + nameslist)
      raise ValueError("unsupported order value: %s" % (order,))
function_tokens: def _newnames ( datatype , order ) : oldnames = datatype . names nameslist = list ( oldnames ) if isinstance ( order , ( str , unicode ) ) : order = [ order ] seen = set ( ) if isinstance ( order , ( list , tuple ) ) : for name in order : try : nameslist . remove ( name ) except ValueError : if name in seen : raise ValueError ( "duplicate field name: %s" % ( name , ) ) else : raise ValueError ( "unknown field name: %s" % ( name , ) ) seen . add ( name ) return tuple ( list ( order ) + nameslist ) raise ValueError ( "unsupported order value: %s" % ( order , ) )