It seems necessary that state[EntityType] should implement full Mapping interface (using some Pyton mixin (maybe abc.collections.Mappings), it should be enough to implement __getitem__, __len__ and __iter__ or something like that. Concering Django, lazy iteration can be achieved using QuerySets.
At this point, we should also implement inheritable tests (StateContractTests) for checking that the state contract is satisfied.
Also consider a filter method. This should be also straightforward in both pure Python (returning a "list comprehensions iterator") and Django (filter method on queryset).
It seems necessary that
state[EntityType]
should implement full Mapping interface (using some Pyton mixin (maybeabc.collections.Mappings
), it should be enough to implement__getitem__
,__len__
and__iter__
or something like that. Concering Django, lazy iteration can be achieved using QuerySets.At this point, we should also implement inheritable tests (StateContractTests) for checking that the state contract is satisfied.
Also consider a filter method. This should be also straightforward in both pure Python (returning a "list comprehensions iterator") and Django (filter method on queryset).