class_docstr: Class to represent a set of operators with a certain attribute.
  
  **Example**
  
  Suppose we would like to store a list of which qubit operations are
  Pauli operators. We can create a new ``Attribute``, ``pauli_ops``, like so,
  listing which operations satisfy this property.
  
  >>> pauli_ops = Attribute(["PauliX", "PauliZ"])
  
  We can check either a string or an Operation for inclusion in this set:
  
  >>> qml.PauliX(0) in pauli_ops
  True
  >>> "Hadamard" in pauli_ops
  False
  
  We can also dynamically add operators to the sets at runtime, by passing
  either a string, an operation class, or an operation itself. This is useful
  for adding custom operations to the attributes such as
  ``composable_rotations`` and ``self_inverses`` that are used in compilation
  transforms.
  
  >>> pauli_ops.add("PauliY")
  >>> pauli_ops
  ["PauliX", "PauliY", "PauliZ"]
class_docstr_tok: ["Class","to","represent","a","set","of","operators","with","a","certain","attribute",".","*","*","Example","*","*","Suppose","we","would","like","to","store","a","list","of","which","qubit","operations","are","Pauli","operators",".","We","can","create","a","new","``","Attribute","``",",","``","pauli_ops","``",",","like","so",",","listing","which","operations","satisfy","this","property",".",">",">",">","pauli_ops","=","Attribute","(","[","``","PauliX","''",",","``","PauliZ","''","]",")","We","can","check","either","a","string","or","an","Operation","for","inclusion","in","this","set",":",">",">",">","qml.PauliX","(","0",")","in","pauli_ops","True",">",">",">","``","Hadamard","''","in","pauli_ops","False","We","can","also","dynamically","add","operators","to","the","sets","at","runtime",",","by","passing","either","a","string",",","an","operation","class",",","or","an","operation","itself",".","This","is","useful","for","adding","custom","operations","to","the","attributes","such","as","``","composable_rotations","``","and","``","self_inverses","``","that","are","used","in","compilation","transforms",".",">",">",">","pauli_ops.add","(","``","PauliY","''",")",">",">",">","pauli_ops","[","``","PauliX","''",",","``","PauliY","''",",","``","PauliZ","''","]"]
docstr: Check if the attribute contains a given Operator.
docstr_tok: ["Check","if","the","attribute","contains","a","given","Operator","."]
code: def __contains__(self, obj):
      """Check if the attribute contains a given Operator."""
      if isinstance(obj, str):
          return super().__contains__(obj)
  
      # Hotfix: return False for all tensors.
      # Can be removed or updated when tensor class is
      # improved.
      if isinstance(obj, Tensor):
          return False
  
      if isinstance(obj, Operator):
          return super().__contains__(obj.name)
  
      if isclass(obj):
          if issubclass(obj, Operator):
              return super().__contains__(obj.__name__)
  
      return False
  
imports: from inspect import isclass
  from pennylane.operation import Operator, Tensor
label_desc: Use image node_id 2 for calling the Attribute obj's underlying member method code with example usage: obj.__contains__(obj) and returns: False, super, False, super, super