Coding 2023-04-24

Tags:
By Max Woerner Chase

So, I ended up tabling the "remove defaults" idea in favor of putting in a feature request to Mypy to see where that goes. I can anticipate some potential objections to it, and I'm not sure how to address them, so I need people who understand Mypy better than I do to discuss it some.

There are two major reasons I swung around to a feature request:

My guess is that, with some effort, I could get Pylint working nicely with this idea, but I'd rather focus on the feature request for now.

Let's see about chasing down the information that got me down this tangent in the first place...

In terms of raw volume of code, it's not clear that doing this would constitute a win, but it would mean moving code out of the more data-y modules, so I at least want to evaluate how much of a mess it would make.

Let's treat the top-level data structures as mostly straightforward, and focus on the type fiddling.

Now, the thing that hopefully makes this less confusing than the existing functions is, I don't need special handling for different entry point types. Everything just gets passed through, no questions asked.

Before I mess around with new code, I want to investigate using the techniques from this comment in the existing code.

(Update: Things aren't currently looking great for the Mypy feature request, so I'm trying to nail down what I'd want out of a plugin. Like, the brief is, the constructor for a generic attrs class shouldn't have any optional arguments, and the question is just how to express that in terms of whatever I use to lint.)

Anyway, back to messing with the code...

So, I've proved that this still works, and the behavior is preserved (up to and including the mystery errors from recent Mypy versions).

At the moment, I just want to wrap up and get to bed, but this was nice for proving out the approach for handling the placeholder updates. I'll try to do that in the next few days, and hopefully it'll get me some data points for those mystery errors.

Good night.