class_docstr: A defaultdict that creates default values based on the associated key.
  
  Note that the standard defaultdict can only produce default values (via its factory)
  that are independent of the key under which they are stored.
  As opposed to that, the lambda functions used as factories for this
  `LambdaDefaultDict` class do accept a single argument: The missing key.
  If a missing key is accessed by the user, the provided lambda function is called
  with this missing key as its argument. The returned value is stored in the
  dictionary under that key and returned.
  
  Example:
  
      In this example, if you try to access a key that doesn't exist, it will call
      the lambda function, passing it the missing key. The function will return a
      string, which will be stored in the dictionary under that key.
  
      .. testcode::
  
          from ray.rllib.utils.lambda_defaultdict import LambdaDefaultDict
  
          default_dict = LambdaDefaultDict(lambda missing_key: f"Value for {missing_key}")
          print(default_dict["a"])
  
      .. testoutput::
  
          Value for a
class_docstr_tok: ["A","defaultdict","that","creates","default","values","based","on","the","associated","key",".","Note","that","the","standard","defaultdict","can","only","produce","default","values","(","via","its","factory",")","that","are","independent","of","the","key","under","which","they","are","stored",".","As","opposed","to","that",",","the","lambda","functions","used","as","factories","for","this","`","LambdaDefaultDict","`","class","do","accept","a","single","argument",":","The","missing","key",".","If","a","missing","key","is","accessed","by","the","user",",","the","provided","lambda","function","is","called","with","this","missing","key","as","its","argument",".","The","returned","value","is","stored","in","the","dictionary","under","that","key","and","returned",".","Example",":","In","this","example",",","if","you","try","to","access","a","key","that","does","n't","exist",",","it","will","call","the","lambda","function",",","passing","it","the","missing","key",".","The","function","will","return","a","string",",","which","will","be","stored","in","the","dictionary","under","that","key",".","..","testcode",":",":","from","ray.rllib.utils.lambda_defaultdict","import","LambdaDefaultDict","default_dict","=","LambdaDefaultDict","(","lambda","missing_key",":","f","''","Value","for","{","missing_key","}","''",")","print","(","default_dict","[","``","a","''","]",")","..","testoutput",":",":","Value","for","a"]
docstr: Initializes a LambdaDefaultDict instance.
  
  Args:
      default_factory: The default factory callable, taking a string (key)
          and returning the default value to use for that key.
docstr_tok: ["Initializes","a","LambdaDefaultDict","instance",".","Args",":","default_factory",":","The","default","factory","callable",",","taking","a","string","(","key",")","and","returning","the","default","value","to","use","for","that","key","."]
code: def __init__(
      self, default_factory: Callable[[str], Any], *args, **kwargs
  ):
      """Initializes a LambdaDefaultDict instance.
  
      Args:
          default_factory: The default factory callable, taking a string (key)
              and returning the default value to use for that key.
      """
      if not callable(default_factory):
          raise TypeError("First argument must be a Callable!")
  
      # We will handle the factory in __missing__ method.
      super().__init__(None, *args, **kwargs)
  
      self.default_factory = default_factory
  
imports: from collections import defaultdict
  from typing import Any, Callable
label_desc: Use image node_id 1 to create a new LambdaDefaultDict object from inherited base classes: defaultdict with example: obj = LambdaDefaultDict(default_factory)