Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Now it's a single value:

    case [typeof(X) for x in X] of:
        [int, int]:
            ...
        [int, float]:
            ...


    { (int, int): methodWithTwoInts,
       (int, float): methodsWithIntAndFloat,
       ...
    }[  tuple([typeof(x) for x in X])  ]()


Actually this is better that switch (or whatever).

Some advanced dispatch code can notice that some tuples are dispatched more often that the rest and can check for them first.

Ditto for dict lookup.

But this would unexpected for switch code.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: