On 9/17/20 2:18 PM, John Snow wrote:
Your type hint adds a restriction that wasn't there before.
Is there a better way?
I've settled on using the `object` type for now, which is slightly more
restrictive than `Any`.
`Any` and `object` both allow any type of argument, but `Any`
effectively creates a gradually typed boundary in which you are
implicitly casting to whatever typed boundary it enters next.
`object` is an explicit cast to the most abstracted type; any further
usage that is not supported the base object will be rejected.
This is nice, because if someone adds a call at or below the mcgen
level, mypy will certainly complain that they are assuming too much
about the type -- and they would be!
The rest of my series will now take this approach: prefer `object` to `Any`.
--js