2 ms·
Now it's a single value: case [typeof(X) for x in X] of: [int, int]: ... [int, float]: ...
by yummyfajitas 15y ago
Now it's a single value:
case [typeof(X) for x in X] of:
[int, int]:
...
[int, float]:
...
- icebraining 15y ago{ (int, int): methodWithTwoInts, (int, float): methodsWithIntAndFloat, ... }[ tuple([typeof(x) for x in X]) ]()
- adobriyan 15y agoActually 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.