def add_traits(base, names, trait_type=None):
 if (trait_type is None):
  trait_type = traits.Any
 undefined_traits = {}
 for key in names:
  base.add_trait(key, trait_type)
  undefined_traits[key] = Undefined
 base.trait_set(trait_change_notify=False, **undefined_traits)
 for key in names:
  _ = getattr(base, key)
 return base

def add_traits ( base , names , trait_type = None ) : if ( trait_type is None ) : trait_type = traits . Any undefined_traits = { } for key in names : base . add_trait ( key , trait_type ) undefined_traits [ key ] = Undefined base . trait_set ( trait_change_notify = False , ** undefined_traits ) for key in names : _ = getattr ( base , key ) return base
add traits to a traited class .