Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frozenlist Hash Implementation #38

Open
xinhong3 opened this issue Nov 13, 2024 · 0 comments
Open

Frozenlist Hash Implementation #38

xinhong3 opened this issue Nov 13, 2024 · 0 comments

Comments

@xinhong3
Copy link

Why is sorted needed in 'freeze.py'?

Exception:

  File ".../distalgo-master/da/freeze.py", line 88, in __hash__
    h = self._cached_hash = hash(tuple(sorted(self)))
TypeError: '<' not supported between instances of 'SomeClass' and 'SomeClass'
class SomeClass:
    def __init__(self, val):
        self.val = val

class Primary(process):
    def setup(nBackups: int):
        pass

    def run():
        await(len(setof(p, received(("hello", _, _), from_= p))) >= nBackups)
        
        values = setof(
            v, received(("hello", v, _))
        )
        
        output(values)

class Backup(process):
    def setup(primary):
        pass

    def run():
        send(("hello", [SomeClass(1), SomeClass(2)], self), to = primary)

def main():
    nbackups = 3
    primary = new(Primary, (nbackups,), num= 1)
    backups = new(Backup, (primary,), num= nbackups)
    start(backups | primary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant