Coding 2024-04-04

By Max Woerner Chase


I've got some bad news about this one, folks.

Aw, come on!


Show them what you decided to work on.


:) (glitchy)

Show them!


from __future__ import annotations

import abc
import typing

class Combinable(typing.Protocol):
    """Protocol for classes whose instances can be combined."""

    def combine(self: T, __other: T) -> T:
        """Combine two instances of the same type."""
        return self.combine(__other)

T = typing.TypeVar("T", bound=Combinable)


I can't help but notice that you're proposing to replace a single lambda with two lines of code.

It's unaesthetic. Besides, I haven't actually touched any code yet. That up there is the prototype. This whole exchange was a rhetorical framework to give me an excuse to write the code.


Touché. Regardless, it is impressive and horrifying how much nonsense mypy appears to be prepared to accept from you.

Yeah! It's all like "So, you specifically want a union to be considered to implement a protocol? Yeah sure I'll add that to my worldview."


The point is. What actually needs effort put into it is isolating modules like this so it's possible to find common themes in what remains. Updating the code in any way seems quite beside the point at this juncture.

All right, I'll try to follow that advice, and not solely because I just got tired of typing this post in two voices.

Looking for modules without many dependencies. Let's see...

All in all, this only gives us a few packages with license to ignore them:

The really valuable ones to remove are dependent_mapping and saltate, because they slow down testing.

As far as organizing things, I'd like to pull out the matrix ecosystem into its own submodule at least, but the circular dependency between matrix and artifact, as well as artifact's various "core" dependencies makes me not like that. Perhaps if I could find a non-obnoxious way to break the dependency.

Anyway, one thing that's getting hammered home from inspecting the usages of the various modules is that I really should move cmd.PathStr into some kind of generally usable module, because many modules import cmd only for PathStr.

I think, ultimately, I can only take typing up notes so far. I'm going to have to print out a module listing and scribble on it.

Not right now, though. I think I taxed my eyes a bit writing this, so I'm going to get away from my laptop.

Good night.