make `Namespace` iterable
@zrgt suggested on Zulip, that classes like Submodel
and SubmodelElementCollection
should be iterable.
@mhthies suggested to make Namespaces iterable with an implementation similar to the following:
class Namespace:
[…]
def __iter__(self):
return itertools.chain.from_iterable(self.namespace_element_sets)
This would make all classes which inherit from Namespace
iterable over their contained NamespaceSet
s, namely AssetAdministrationShell
, Submodel
, SubmodelElementCollection
, AnnotatedRelationshipElement
and Entity
.