Skip to content

Frozenlist Hash Implementation #38

@xinhong3

Description

@xinhong3

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions