define_homogeneous_container_type

(function from pyomo.core.kernel.container_utils)

pyomo.core.kernel.container_utils.define_homogeneous_container_type(namespace, name, container_class, ctype, doc=None, use_slots=True)[source]

This function is designed to be called for the simple container implementations (DictContainer, TupleContainer, and ListContainer) as the container_class argument.

When called using the globals() namespace within a module, it is equivalent to placing the following class definition within that module:

class <name>(<container_class>):
    <doc>
    _ctype = <ctype>

    ### if ### <use_slots>
    __slots__ = ("_parent",
                 "_storage_key",
                 "_active",
                 "_data",
                 "__weakref__")
    ### fi ###

    def __init__(self, *args, **kwds):
        self._parent = None
        self._storage_key = None
        self._active = True
        super(<name>, self).__init__(*args, **kwds)