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: Used when loading a pickled space.
  
  This method has to be implemented explicitly to allow for loading of legacy states.
  
  Args:
      state: The new state
docstr_tok: ["Used","when","loading","a","pickled","space",".","This","method","has","to","be","implemented","explicitly","to","allow","for","loading","of","legacy","states",".","Args",":","state",":","The","new","state"]
code: def __setstate__(self, state):
      """Used when loading a pickled space.
  
      This method has to be implemented explicitly to allow for loading of legacy states.
  
      Args:
          state: The new state
      """
      # Don't mutate the original state
      state = dict(state)
  
      # Allow for loading of legacy states.
      # See https://github.com/openai/gym/pull/2470
      if "start" not in state:
          state["start"] = 0
  
      super().__setstate__(state)
  
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 7 for calling the Discrete obj's underlying member method code with example usage: obj.__setstate__(state) without return types