Another approach is to abandon the idea of HDL namespace parent class, and
just create a HDL (or hdl) decorator:

@hdl  # decorator adds a custom __setattr__
class C: ...

The decorator would modify the __setatrr__ method of the class so that
members of the class have signal behavior. You could even write the
decorator so that you specify which attributes have signal behavior, and
the remainders don't:

@hdl(list('xyz'))
class C:
    def __init__(self, **kwargs):
        for k,v in kwargs.items():
            setattr(self, k, v)

c = C(x=1, a=2)  # x is a signal, a is not
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to