|
|
|
|
|
by joshuamorton
3097 days ago
|
|
Sure, but at that point you've just reimplemented python in macros ;) The other thing to note is that sorted([(k.weight, k.name) for k in somelist], reverse=True)
is essentially already typechecked: def biggest_ks(ks: K):
return sorted([(k.weight, k.name) for k in ks], reverse=True)
The above code now has all the same type guarantees as your c++, actually maybe more since the macros you use are going to be...uhhh, mysterious. |
|
My point was just that you can implement almost whatever you want (even without macros, they'll just expand the design space).