parameters: (mcs, name, parent, attr)
return_statement: return type.__new__(mcs, name, parent, attr)
docstring: Simplify the implementation of the numeric/logical sequence API.
docstring_summary: Simplify the implementation of the numeric/logical sequence API.
docstring_tokens: Simplify the implementation of the numeric / logical sequence API .
function: def __new__(mcs, name, parent, attr):
          """Simplify the implementation of the numeric/logical sequence API."""
          def add_numeric_op(attr_name, op):
              """Create an attribute named attr_name that calls
              _numeric_op(self, other, op)."""
              def closure(self, other):
                  return VTKCompositeDataArray._numeric_op(self, other, op)
              closure.__name__ = attr_name
              attr[attr_name] = closure
  
          def add_reverse_numeric_op(attr_name, op):
              """Create an attribute named attr_name that calls
              _reverse_numeric_op(self, other, op)."""
              def closure(self, other):
                  return VTKCompositeDataArray._reverse_numeric_op(self, other, op)
              closure.__name__ = attr_name
              attr[attr_name] = closure
  
          def add_default_reverse_numeric_op(op_name):
              """Adds '__r[op_name]__' attribute that uses operator.[op_name]"""
              add_reverse_numeric_op("__r%s__"%op_name, getattr(operator, op_name))
  
          def add_default_numeric_op(op_name):
              """Adds '__[op_name]__' attribute that uses operator.[op_name]"""
              add_numeric_op("__%s__"%op_name, getattr(operator, op_name))
  
          def add_default_numeric_ops(op_name):
              """Call both add_default_numeric_op and add_default_reverse_numeric_op."""
              add_default_numeric_op(op_name)
              add_default_reverse_numeric_op(op_name)
  
          add_default_numeric_ops("add")
          add_default_numeric_ops("sub")
          add_default_numeric_ops("mul")
          if sys.hexversion < 0x03000000:
              add_default_numeric_ops("div")
          add_default_numeric_ops("truediv")
          add_default_numeric_ops("floordiv")
          add_default_numeric_ops("mod")
          add_default_numeric_ops("pow")
          add_default_numeric_ops("lshift")
          add_default_numeric_ops("rshift")
          add_numeric_op("__and__", operator.and_)
          add_reverse_numeric_op("__rand__", operator.and_)
          add_default_numeric_ops("xor")
          add_numeric_op("__or__", operator.or_)
          add_reverse_numeric_op("__ror__", operator.or_)
  
          add_default_numeric_op("lt")
          add_default_numeric_op("le")
          add_default_numeric_op("eq")
          add_default_numeric_op("ne")
          add_default_numeric_op("ge")
          add_default_numeric_op("gt")
          return type.__new__(mcs, name, parent, attr)
function_tokens: def __new__ ( mcs , name , parent , attr ) : def add_numeric_op ( attr_name , op ) : """Create an attribute named attr_name that calls
              _numeric_op(self, other, op).""" def closure ( self , other ) : return VTKCompositeDataArray . _numeric_op ( self , other , op ) closure . __name__ = attr_name attr [ attr_name ] = closure def add_reverse_numeric_op ( attr_name , op ) : """Create an attribute named attr_name that calls
              _reverse_numeric_op(self, other, op).""" def closure ( self , other ) : return VTKCompositeDataArray . _reverse_numeric_op ( self , other , op ) closure . __name__ = attr_name attr [ attr_name ] = closure def add_default_reverse_numeric_op ( op_name ) : """Adds '__r[op_name]__' attribute that uses operator.[op_name]""" add_reverse_numeric_op ( "__r%s__" % op_name , getattr ( operator , op_name ) ) def add_default_numeric_op ( op_name ) : """Adds '__[op_name]__' attribute that uses operator.[op_name]""" add_numeric_op ( "__%s__" % op_name , getattr ( operator , op_name ) ) def add_default_numeric_ops ( op_name ) : """Call both add_default_numeric_op and add_default_reverse_numeric_op.""" add_default_numeric_op ( op_name ) add_default_reverse_numeric_op ( op_name ) add_default_numeric_ops ( "add" ) add_default_numeric_ops ( "sub" ) add_default_numeric_ops ( "mul" ) if sys . hexversion < 0x03000000 : add_default_numeric_ops ( "div" ) add_default_numeric_ops ( "truediv" ) add_default_numeric_ops ( "floordiv" ) add_default_numeric_ops ( "mod" ) add_default_numeric_ops ( "pow" ) add_default_numeric_ops ( "lshift" ) add_default_numeric_ops ( "rshift" ) add_numeric_op ( "__and__" , operator . and_ ) add_reverse_numeric_op ( "__rand__" , operator . and_ ) add_default_numeric_ops ( "xor" ) add_numeric_op ( "__or__" , operator . or_ ) add_reverse_numeric_op ( "__ror__" , operator . or_ ) add_default_numeric_op ( "lt" ) add_default_numeric_op ( "le" ) add_default_numeric_op ( "eq" ) add_default_numeric_op ( "ne" ) add_default_numeric_op ( "ge" ) add_default_numeric_op ( "gt" ) return type . __new__ ( mcs , name , parent , attr )