For the understanding of all, it would help tremendously for you to implement a WORKING TOY example showing exactly the behavior you want in real (not theoretical) python, maybe something like this as a starting point:
<http://python.org/psf/codeofconduct/> class SignalBehavior: """"A descriptor that behaves like a HDL signal""" def __init__(self): # actual values for each inst stored here inst_dict = dict() def __get__(self,inst,owner): if inst is None: return self # getting of a signal behavior here # most basic version: return self.inst_dict[inst] def __set__(self,inst,value): # assignment of a signal behavior here # most basic version: self.inst_dict[inst] = value class HDL: """Every new member of this namespace has signal behavior""" def __setattr__(self, attr, value): # note: if attr existed already, # SignalBehavior.__set__ was called # add attr as signal behavior setattr(type(self), attr, SignalBehavior()) # SignalBehavior.__set__ will now be called setattr(self, attr, value) And then demo some simple operations like this: hdlns = HDL() hdlns.x = 1. # .x is a new descriptor hdlns.y = 2. # .y is a new descriptor # .z will also be a new descriptor hdlns.z = hdlns.x + hdlns.y ~~~ all hdlns members above behave like signals ~~~ >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/