docstr: Create a configurable given a config config.
  
  Parameters
  ----------
  config : Config
      If this is empty, default values are used. If config is a
      :class:`Config` instance, it will be used to configure the
      instance.
  parent : Configurable instance, optional
      The parent Configurable instance of this object.
  
  Notes
  -----
  Subclasses of Configurable must call the :meth:`__init__` method of
  :class:`Configurable` *before* doing anything else and using
  :func:`super`::
  
      class MyConfigurable(Configurable):
          def __init__(self, config=None):
              super(MyConfigurable, self).__init__(config=config)
              # Then any other code you need to finish initialization.
  
  This ensures that instances will be configured properly.
docstr_tok: ["Create","a","configurable","given","a","config","config",".","Parameters","--","--","--","--","--","config",":","Config","If","this","is","empty",",","default","values","are","used",".","If","config","is","a",":","class",":","`","Config","`","instance",",","it","will","be","used","to","configure","the","instance",".","parent",":","Configurable","instance",",","optional","The","parent","Configurable","instance","of","this","object",".","Notes","--","--","-","Subclasses","of","Configurable","must","call","the",":","meth",":","`","__init__","`","method","of",":","class",":","`","Configurable","`","*","before","*","doing","anything","else","and","using",":","func",":","`","super","`",":",":","class","MyConfigurable","(","Configurable",")",":","def","__init__","(","self",",","config=None",")",":","super","(","MyConfigurable",",","self",")",".__init__","(","config=config",")","#","Then","any","other","code","you","need","to","finish","initialization",".","This","ensures","that","instances","will","be","configured","properly","."]
code: def __init__(self, **kwargs):
      """Create a configurable given a config config.
  
      Parameters
      ----------
      config : Config
          If this is empty, default values are used. If config is a
          :class:`Config` instance, it will be used to configure the
          instance.
      parent : Configurable instance, optional
          The parent Configurable instance of this object.
  
      Notes
      -----
      Subclasses of Configurable must call the :meth:`__init__` method of
      :class:`Configurable` *before* doing anything else and using
      :func:`super`::
  
          class MyConfigurable(Configurable):
              def __init__(self, config=None):
                  super(MyConfigurable, self).__init__(config=config)
                  # Then any other code you need to finish initialization.
  
      This ensures that instances will be configured properly.
      """
      parent = kwargs.pop("parent", None)
      if parent is not None:
          # config is implied from parent
          if kwargs.get("config", None) is None:
              kwargs["config"] = parent.config
          self.parent = parent
  
      config = kwargs.pop("config", None)
  
      # load kwarg traits, other than config
      super(Configurable, self).__init__(**kwargs)
  
      # load config
      if config is not None:
          # We used to deepcopy, but for now we are trying to just save
          # by reference.  This *could* have side effects as all components
          # will share config. In fact, I did find such a side effect in
          # _config_changed below. If a config attribute value was a mutable type
          # all instances of a component were getting the same copy, effectively
          # making that a class attribute.
          # self.config = deepcopy(config)
          self.config = config
      else:
          # allow _config_default to return something
          self._load_config(self.config)
  
      # Ensure explicit kwargs are applied after loading config.
      # This is usually redundant, but ensures config doesn't override
      # explicitly assigned values.
      for key, value in kwargs.items():
          setattr(self, key, value)
  
imports: from __future__ import print_function, absolute_import
  from copy import deepcopy
  import warnings
  from .loader import Config, LazyConfigValue, _is_section_key
  from traitlets.traitlets import HasTraits, Instance, observe, observe_compat, default
  from ipython_genutils.text import indent, dedent, wrap_paragraphs
label_desc: Use image node_id 1 to create a new Configurable object from inherited base classes: HasTraits with example: obj = Configurable()