« DarwiinRemote with support for mapping analog sticks to keysMath Notation Is Terrible »

typed module for Python

10/06/08

Permalink 08:47:21 am, 173 words
Categories: Code

typed module for Python

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.

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
open source blog software