The datatypes module

Some generic datatypes used by quickly.

Too small to justify separate modules but too generic to be added to some module where they are actually used.

class Properties(**kwargs)[source]

Bases: object

A dictionary-like object that accesses keys as attributes.

Adding another Properties object returns a new Properties instance with updated dict contents. Example:

>>> from quickly.datatypes import Properties
>>> p = Properties(repeat_count=3)
>>> p
<Properties repeat_count=3>
>>> p.repeat_count
>>> p1 = Properties(unfold=True)
>>> p + p1
<Properties repeat_count=3 unfold=True>
>>> del p.repeat_count
>>> p

Accessing a non-existent property name returns None. Deleting a non-existent property does not raise an AttributeError. Setting an attribute to None does keep the attribute, and when adding the properties to another, the same property in the other will be overwritten by the newer one that was set to None.

Use vars() to get a dictionary view on the properties. Use "key" in props to see whether an attribute is really present. An empty Properties object evaluates to False.