I did consider using a transformed version of value, e.g. value+1 if it was an integer or value+"x" if a string, but in each of those cases I couldn't see any reason you'd do that – if you knew the type of value anyway, it would be easier to just compare it against some constant thing not of that type.
But it hadn't occurred to me that not value would apply to all types. Cunning.
Yeah. I considered that, if the function is parameterised by the type of value, you could have a meta-type, but I didn't expect to think of anything neat. Thinking about it, the tricky (but not very efficient) way would be to have a vector (or any other container type) containing value (assuming python doesn't support vectors nested infinitely deep :))
But "not" is very good. Are there any weird edge cases? :)
I did consider using a transformed version of
value, e.g.value+1if it was an integer orvalue+"x"if a string, but in each of those cases I couldn't see any reason you'd do that – if you knew the type ofvalueanyway, it would be easier to just compare it against some constant thing not of that type.But it hadn't occurred to me that
not valuewould apply to all types. Cunning.But "not" is very good. Are there any weird edge cases? :)