19 lines
398 B
Python
19 lines
398 B
Python
from abc import ABCMeta
|
|
|
|
|
|
class IterRegistry(type):
|
|
def __iter__(cls):
|
|
for ref in cls._registry:
|
|
obj = ref()
|
|
if obj is not None:
|
|
yield obj
|
|
|
|
|
|
class AbstractIterMeta(ABCMeta):
|
|
def __iter__(cls):
|
|
for ref in cls._registry:
|
|
obj = ref()
|
|
print(f'obj: {obj}')
|
|
if obj is not None:
|
|
yield obj
|