Is this [PSOX]/Am I a WTF?
I made a system, called PSOX, to allow stdio-only language like Brainfuck to access the network and files etc.. The project is mostly dead due to the fact that I'm the only one interested in it due to my continuous nonstop mention of it on IRC.. I'm wondering if the code, (and possibly the spec) is a major WTF. I hope these responses can help me improve my coding style etc. Note that I do NOT care for flames telling me how this is a worthless project, I know that there is no real-life use for this thing. I just want to know how good/bad the code and spec is.
Control characters, and NUL are pretty hard to write in some languages that do text IO and won't survive some IO media. That's the first WTF. ASCII NUL may be impossible to read over a cooked stdio FILE because it typically counts as an alternate line terminator as well. While I appreciate your use of real numbers in the spec files, (the telnet RFC for example buries the code for IAC at the bottom of the document), it's a little hard to read when you really mean (NUL Service-Code Function-Id) as a three byte sequence. Abstract a little.
Probably the biggest WTF is that you can already do this with AWK (to files, pipes, and TCP sockets) and even specify your own commands.
The code looks pretty average for a python app of that size, but you'd be better off not scrunching it all onto the module top. How about making a stateful PSOX object and invoking it in an if name block?
Having comments consisting of debug prints disturbs the eye a bit. Admittedly I do this too, but it's a better habit to either explain a bit or be terse.
All this having been said, thinking out these kinds of things, even as an exercise, improves your skills. Sometimes you do a little project and learn a good deal, even if the outcome is pretty mundane.
I say, go on learning wheels by inventing them! You might be the only person nearby who really understands why they come out round some day.