colour.utilities.Structure¶
-
class
colour.utilities.
Structure
(*args, **kwargs)[source]¶ Defines an object similar to C/C++ structured type.
Other Parameters: - *args (list, optional) – Arguments.
- **kwargs (dict, optional) – Key / Value pairs.
References
Examples
>>> person = Structure(first_name='Doe', last_name='John', gender='male') >>> # Doctests skip for Python 2.x compatibility. >>> person.first_name 'Doe' >>> sorted(person.keys()) ['first_name', 'gender', 'last_name'] >>> # Doctests skip for Python 2.x compatibility. >>> person['gender'] 'male'
Methods
__init__
(*args, **kwargs)clear
(() -> None. Remove all items from D.)copy
(() -> a shallow copy of D)fromkeys
(…)v defaults to None. get
((k[,d]) -> D[k] if k in D, …)has_key
((k) -> True if D has a key k, else False)items
(() -> list of D’s (key, value) pairs, …)iteritems
(() -> an iterator over the (key, …)iterkeys
(() -> an iterator over the keys of D)itervalues
(…)keys
(() -> list of D’s keys)pop
((k[,d]) -> v, …)If key is not found, d is returned if given, otherwise KeyError is raised popitem
(() -> (k, v), …)2-tuple; but raise KeyError if D is empty. setdefault
((k[,d]) -> D.get(k,d), …)update
(*args, **kwargs)Updates both keys and sibling attributes. values
(() -> list of D’s values)viewitems
(…)viewkeys
(…)viewvalues
(…)