[Python-ideas] Operator as first class citizens -- like in scala -- or yet another new operator?

Ricky Teachey ricky at teachey.org
Wed May 29 10:42:58 EDT 2019


Seems like this would do it (note: `in` can't actually be a variable):

class A(HDL):
    # A is now an HDL namespace - all members have signal behavior
    def __init__(self, in, o1, o2):
        self.in = in  # descriptor
        self.o1 = o1 ; self.o2 = o2   # descriptors
    def process(self):
        # is self.in, self.o1 and self.o2 are still descriptor here to be
used?
        # ^  yes, all of those are SignalBehavior descriptors if A is
subclass of HDL ^

class C:
    # depending on behavior desired, C could be HDL namespace, too
    def __init__(self, in, out):
        # these work, but probably are not needed:
        ns.in = 0
        ns.o1 = 0
        ns.o2 = 0
        a = A( ns.in  ,  ns.o1 ,   ns.o2 )
        # ...you can just pass the values to A directly as long as
        # A (or HDL) knows what to do with arbitrary in and out values:
        a = A(in, out,  out)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190529/9033ff5e/attachment.html>


More information about the Python-ideas mailing list