class_docstr: A space consisting of finitely many elements.
  
  This class represents a finite subset of integers, more specifically a set of the form :math:`\{ a, a+1, \dots, a+n-1 \}`.
  
  Example::
  
      >>> Discrete(2)            # {0, 1}
      >>> Discrete(3, start=-1)  # {-1, 0, 1}
class_docstr_tok: ["A","space","consisting","of","finitely","many","elements",".","This","class","represents","a","finite","subset","of","integers",",","more","specifically","a","set","of","the","form",":","math",":","`","\\","{","a",",","a+1",",","\\dots",",","a+n-1","\\","}","`",".","Example",":",":",">",">",">","Discrete","(","2",")","#","{","0",",","1","}",">",">",">","Discrete","(","3",",","start=-1",")","#","{","-1",",","0",",","1","}"]
docstr: Return boolean specifying if x is a valid member of this space.
docstr_tok: ["Return","boolean","specifying","if","x","is","a","valid","member","of","this","space","."]
code: def contains(self, x) -> bool:
      """Return boolean specifying if x is a valid member of this space."""
      if isinstance(x, int):
          as_int = x
      elif isinstance(x, (np.generic, np.ndarray)) and (
          np.issubdtype(x.dtype, np.integer) and x.shape == ()
      ):
          as_int = int(x)  # type: ignore
      else:
          return False
  
      return self.start <= as_int < self.start + self.n
  
file_path: gym/gym/spaces/discrete.py
imports: from typing import Optional, Union
  import numpy
  from gym.spaces.space import Space
label_desc: Use image node_id 4 for calling the Discrete obj's underlying member method code with example usage: obj.contains(x) and returns: unknown, False