| « DarwiinRemote with support for mapping analog sticks to keys | Math Notation Is Terrible » |
Now that I’ve gotten over the horror of adding runtime-checked types
to Python, badly, I keep having new ideas. My latest was struct, which
addresses both my need for something more structured than a tuple and
less than a full class. Somebody asked for the code in
the comments to my last post, so here it is. It is
intentionally in a rough state. Do not use this code without
reading it. In fact, I would appreciate it if you’d fill in some
of the stubs or write some tests. There is a small dependency on my util
library, but only for changing function.__name__ in a
Python-version-independent way, and for subsetting a dictionary.
I don’t really recommend that you use this, though. This kind of
half-baked metaprogramming code is what makes reusing others’ code in
Scheme so unpleasant. I only use it because type-checking compilers
are so insistent that the types be right before running my code, and chances are I’ll never polish it enough that other people can use it easily.