# Container Properties¶

## Tuple¶

class properties.Tuple(doc, prop=None, **kwargs)[source]

Property for tuples, where each entry is another Property type

Available keywords (in addition to those inherited from Property):

• prop - Property instance that specifies the Property type of each entry in the Tuple. A HasProperties class may also be specified; this is simply coerced to an Instance Property of that class.
• min_length - Minimum valid length of the tuple, inclusive. If None (the default), there is no minimum length.
• max_length - Maximum valid length of the tuple, inclusive. If None (the default), there is no maximum length.
• coerce - If False, input must be a tuple. If True, container types are coerced to a tuple and other non-container values become a length-1 tuple. Default value is False.

## List¶

class properties.List(doc, prop=None, **kwargs)[source]

Property for lists, where each entry is another Property type

Available keywords (in addition to those inherited from Property):

• prop - Property instance that specifies the Property type of each entry in the List. A HasProperties class may also be specified; this is simply coerced to an Instance Property of that class.
• min_length - Minimum valid length of the list, inclusive. If None (the default), there is no minimum length.
• max_length - Maximum valid length of the list, inclusive. If None (the default), there is no maximum length.
• coerce - If False, input must be a list. If True, container types are coerced to a list and other non-container values become a length-1 list. Default value is False.
• observe_mutations - If False, the underlying storage class is a list (or subclass thereof). If True, the underlying storage class will be an observable_copy of the list. The benefit of observing mutations is that all mutations and operations will trigger HasProperties change notifications. The drawback is slower performance as copies of the list are made on every operation.

## Set¶

class properties.Set(doc, prop=None, **kwargs)[source]

Property for sets, where each entry is another Property type

Available keywords (in addition to those inherited from Property):

• prop - Property instance that specifies the Property type of each entry in the Set. A HasProperties class may also be specified; this is simply coerced to an Instance Property of that class.
• min_length - Minimum valid length of the set, inclusive. If None (the default), there is no minimum length.
• max_length - Maximum valid length of the set, inclusive. If None (the default), there is no maximum length.
• coerce - If False, input must be a set. If True, container types are coerced to a set and other non-container values become a length-1 set. Default value is False.
• observe_mutations - If False, the underlying storage class is a set (or subclass thereof). If True, the underlying storage class will be an observable_copy of the set. The benefit of observing mutations is that all mutations and operations will trigger HasProperties change notifications. The drawback is slower performance as copies of the set are made on every operation.

## Dictionary¶

class properties.Dictionary(doc, **kwargs)[source]

Property for dicts, where each key and value is another Property type

Available keywords (in addition to those inherited from Property):

• key_prop - Property instance that specifies the Property type of each key in the Dictionary. A HasProperties class may also be specified; this is simply coerced to an Instance Property of that class.
• value_prop - Property instance that specifies the Property type of each value in the Dictionary. A HasProperties class may also be specified; this is simply coerced to an Instance Property of that class.
• observe_mutations - If False, the underlying storage class is a dict (or subclass thereof). If True, the underlying storage class will be an observable_copy of the dict. The benefit of observing mutations is that all mutations and operations will trigger HasProperties change notifications. The drawback is slower performance as copies of the dict are made on every operation.

## Observable Container Creation¶

properties.base.containers.observable_copy(value, name, instance)[source]

Return an observable container for HasProperties notifications

This method creates a new container class to allow HasProperties instances to observe_mutations. It returns a copy of the input value as this new class.

The output class behaves identically to the input value’s original class, except when it is used as a property on a HasProperties instance. In that case, it notifies the HasProperties instance of any mutations or operations.