class_docstr: Defines the optimisation domain of the objective function. It can be a
  continuous interval or a discrete set of numeric or non-numeric values.
  The latter is also designated as a categorical domain. It is represented as
  a Python dict object with the keys naming the variables and the values defining
  the set of allowed values. A :class:`Domain` can also be recursively
  specified. That is, a key can name a subdomain represented as a Python dict.
  
  For continuous sets use Python list to define an interval in the form
  [a, b], a < b. For discrete sets use Python sets, e.g. {1, 2, 5, -0.1}
  or {"option_a", "option_b"}.
  
  Examples:
      >>> simple_domain = {"x": {0, 1},
      >>>                  "y": [-1, 1],
      >>>                  "z": {-1, 2, 4}}
      >>> nested_domain = {"discrete": {"x": {1, 2, 3}, "y": {4, 5, 6}}
      >>>                  "continuous": {"x": [-4, 4], "y": [0, 1]}
      >>>                  "categorical": {"opt1", "opt2"}}
class_docstr_tok: ["Defines","the","optimisation","domain","of","the","objective","function",".","It","can","be","a","continuous","interval","or","a","discrete","set","of","numeric","or","non-numeric","values",".","The","latter","is","also","designated","as","a","categorical","domain",".","It","is","represented","as","a","Python","dict","object","with","the","keys","naming","the","variables","and","the","values","defining","the","set","of","allowed","values",".","A",":","class",":","`","Domain","`","can","also","be","recursively","specified",".","That","is",",","a","key","can","name","a","subdomain","represented","as","a","Python","dict",".","For","continuous","sets","use","Python","list","to","define","an","interval","in","the","form","[","a",",","b","]",",","a","<","b",".","For","discrete","sets","use","Python","sets",",","e.g",".","{","1",",","2",",","5",",","-0.1","}","or","{","``","option_a","''",",","``","option_b","''","}",".","Examples",":",">",">",">","simple_domain","=","{","``","x","''",":","{","0",",","1","}",",",">",">",">","``","y","''",":","[","-1",",","1","]",",",">",">",">","``","z","''",":","{","-1",",","2",",","4","}","}",">",">",">","nested_domain","=","{","``","discrete","''",":","{","``","x","''",":","{","1",",","2",",","3","}",",","``","y","''",":","{","4",",","5",",","6","}","}",">",">",">","``","continuous","''",":","{","``","x","''",":","[","-4",",","4","]",",","``","y","''",":","[","0",",","1","]","}",">",">",">","``","categorical","''",":","{","``","opt1","''",",","``","opt2","''","}","}"]
docstr: Iterate over the domain if it is fully discrete.
  
  The iterations are over the Cartesian product of all 1-dim discrete
  subdomains.
  
  Raises:
      :class:`DomainNotIterableError`: if the domain has a at least one
      continuous subdomain.
docstr_tok: ["Iterate","over","the","domain","if","it","is","fully","discrete",".","The","iterations","are","over","the","Cartesian","product","of","all","1-dim","discrete","subdomains",".","Raises",":",":","class",":","`","DomainNotIterableError","`",":","if","the","domain","has","a","at","least","one","continuous","subdomain","."]
code: def __iter__(self):
      """Iterate over the domain if it is fully discrete.
  
      The iterations are over the Cartesian product of all 1-dim discrete
      subdomains.
  
      Raises:
          :class:`DomainNotIterableError`: if the domain has a at least one
          continuous subdomain.
      """
      if self._is_continuous:
          raise DomainNotIterableError(
              "The domain has a continuous subdomain and cannot be iterated."
          )
  
      def cartesian_walk(dct):
          if dct:
              key, vals = dct.popitem()
              if isinstance(vals, set):
                  for v in vals:
                      yield from (
                          dict(**rem, **{key: v})
                          for rem in cartesian_walk(copy.deepcopy(dct))
                      )
              elif isinstance(vals, dict):
                  for sub_v in cartesian_walk(copy.deepcopy(vals)):
                      yield from (
                          dict(**rem, **{key: sub_v})
                          for rem in cartesian_walk(copy.deepcopy(dct))
                      )
              else:
                  raise TypeError(
                      f"Unexpected subdomain of type {type(vals)}."
                  )
          else:
              yield {}
  
      yield from map(Sample, cartesian_walk(copy.deepcopy(self._data)))
  
imports: import ast
  import copy
  import os
  import pickle
  import random
  from collections import namedtuple
  from typing import Tuple
label_desc: Use image node_id 2 for calling the Domain obj's underlying member method code with example usage: obj.__iter__() without return types