Coding 2020-04-24

By Max Woerner Chase

Update on the Mypy issue I hit: I was able to reduce the issue to a few lines of code, but I couldn't reproduce it outside the context of the port. I was able to work around the issue, and move on.

I'm going to try to describe what I worked out about the issue, because it's weird:

There are two modules. They import each other. One module defines a type and an instance of that type, as a global value, un-annotated. The other defines a function. In the function, and it's possible I missed some opportunities for reduction, but what I got was: A variable annotated with a type defined in the other module, a variable that is equal to an expression that depends on the first variable and the global value from the other module, and a flow control statement that includes an expression of the form isinstance(var := expr, ...). Under some but not all circumstances, this will crash Mypy. I cannot tell what differentiates things.

Anyway, I'm now working on writing serializers for Ink objects, to go along with the de-serializer I sort of forgot I had to write to make any of this work.

I did that a bit, and now I'm done for tonight.

Good night.