Tao of the MachineProgramming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.
Last 10 archives
:: About me
:: Oasis Digital
More O2 news
After successfully compiling the socket module yesterday, today I added the termios module. Fortunately this was quite easy, since the fix had already been discussed on python-dev.
I also looked at a few Irix-related bugs on Sourceforge, and commented on one, but my help will probably be of limited value, since I didn't encounter any of these problems/errors. I can upload the binary, though, if anyone is interested.
Short O2 news
Slowly but surely I'm exploring Unix (or IRIX, to be precise). Unix is very powerful, but not always easy, and documentation can be sparse. Fortunately, there's always Google.
I managed to remap some keys in the bash shell, using the
As for Python... Last time, the
The system is slowly becoming usable now. Maybe I can start hacking on my projects soon... that would be more than I could on the Mac. (I miss it, but I won't go back anytime soon.)
The prodigal son
If everything goes as planned, I will be visiting the Netherlands again in December. I have been gone for two years now. A lot has happened while I was away... a change of currency, the rise of the extreme right, the first assassination in centuries, two elections, etc. On a more personal level, my parents moved, so I will probably not have the feeling that I'm coming home.
For 28 years, I, like most other Dutch, judged the US by how the media portrayed them -- often negatively. But when you actually live in the States, you get an entirely different view. People make the mistake of projecting their (in my case, Dutch) morals and values on American society, which is usually not a good match. For example, owning a gun may not make sense in the Netherlands, but it makes a lot more sense here in rural Florida. (That doesn't mean that I've suddenly become pro-guns. Don't expect any rabid rants from me about the right to be "armed and dangerous". <wink> But what I'm trying to say is, I can think of reasons why people would want to own a gun, in this environment.)
Funny thing is, for the last two years my image of the Netherlands has only been fed by news from various media, rather than by actually living there. If a foreigner would go only by what the media write about the Netherlands, they would get a very strange picture indeed... disturbing, possibly, and incoherent due to mixed signals. Because, what have been the major news items? Assassination. Strange laws where a store's employees are convicted because they catch a thief. Royal house issues: one prince marries a woman who is tied to Argentina's Videla regime, another marries one who might have been a gangster's girlfriend. Then there's rampant racism, and the rise of right-wing parties. Others say, they're not really on the extreme right, and it's Moroccans who cause a lot of trouble. Economical recession. "Pointless violence" (zinloos geweld). All this on top of the already dubious image of the Netherlands (Amsterdam = drugs).
The impact of these portrayals in the media are such, that even I, a native Dutchman, would almost think that it has become an unsafe and wacky place to live. Almost. I hope I'm wrong. Last time I checked, not everybody in the Netherlands used drugs, much like not every American walks around with a gun or a cowboy hat. In fact, I've seen more drug addicts in Florida than in the 'lands. And I hear about more shootings in the Netherlands than I do here. It's a strange world.
Smart keywords in Firebird
Mozilla Firebird (nee Phoenix) has been my browser of choice for a while now. Overall, I am very content with it. Sure, there are some nitpicks; it can be very slow sometimes, for example. Also, there's one feature I'd like to use, but it doesn't seem to work: smart keywords.
The "Why Mozilla Firebird" page mentions smart keywords. Apparently looking a word up in the dictionary is as easy as typing "dict something" in the location bar... except that it doesn't work. The page suggests that words are looked up at dictionary.com, but rather, it seems that it does a Google "I'm feeling lucky" search. (A feature which is cool and useful in its own right, by the way.) If you're lucky, you get the word definition from one dictionary site or another; otherwise you get something else entirely. dict firebird leads to a word definition, but at die.net. dict spindrift leads to a page has a list of words, but it is is no dictionary at all. dict python leads to... a weblog post by Matt Croydon!
Using "dict:" instead doesn't work either: "dict is not a registered protocol". So what's going on here? The Mozilla page points to two other pages that are supposed to have a list of available keywords, and instructions for how to make your own keywords, but both show "I have no written this page yet". Hmmm.
I noticed this problem in version 0.6. I now have 0.7, but it still doesn't work. It's possible that the problem is on my side, that I somehow have the wrong versions of certain files or something, but I'm not so sure... the other new features seem to work just fine.
Update: Several people pointed out that this should be in Bookmarks > Quick Searches, and that it's easy to add. Indeed it is, and now I know how to add my own keywords. One of the nice things of open source software is that it's open in more than one way... it's often highly configurable.
Update 2: Some useful keywords, contributed by a reader who calls himself Follower:
I've been experimenting a bit with elastiC, now that I have a working version on IRIX. Some thoughts follow.
I think elastiC is an interesting language, but it's not ready for serious work. Sadly, not much development seems to be going on lately. Version 0.0.37 is more than a year old, and the mailing lists are desolate. And since the documentation is not complete, learning the finer points of the language is very difficult.
What makes Python readable?
Following up on my 'Changes' posts... what is it exactly, that makes Python code so readable? Here are some thoughts.
Code is different from text we usually read in books, magazines or web pages. 1) Yet I think it's important that the code format resembles "normal" text, within reason. If there is no equivalent in everyday text, then other "standards" can be used as well. For example, the C language is quite common; when in doubt, borrowing syntax from C may be a good choice. When a language is designed with these informal rules in mind, its constructs will usually be perceived as "intuitive" and "unsurprising", because it connects to what people already know, rather than forcing them to learn new constructs.
So, what features does Python use to improve readability?
Accessor syntax. C uses
Commas. In regular text, commas are used to separate things, like (parts of) sentences, or items in a list. Python's usage of the comma in lists and tuples therefore feels natural. Omitting the commas doesn't feel right, at least not to me (although I'm sure Lispers would disagree); compare
Whitespace for code blocks. Probably the most conspicuous feature of Python. Many languages use
Colons. In everyday text, colons serve a purpose that is not unimportant: they indicate that a clarification follows. Some people think the colon at the end of a function header (or
def foo(bar, baz): ...
clearly says: here's a function foo, and this is its implementation. It just seems stronger and clearer than without the colon.
":" is also used in dictionary literals.
Square brackets. These are used for list literals, and for indexing. Considering that
Curly braces. These are used for dictionary literals. Those are not uncommon, but still less common than code blocks, so there's not so much line noise involved when you write dict literals.
No semicolons. Python does have semicolons, of course, but they are used to separate statements on the same line, a practice which is discouraged and thus not very common. Python lines do not end in a semicolon, which reduces a bit of line noise; usage of ";" as a terminator is not very intuitive, by the way, because in regular text it is not used at the end of a sentence. (A dot would be better in this respect; I believe Prolog does this.)
Fewer "line noise" characters. Guido deliberately tries to avoid characters that aren't used a lot in everyday text.
All these features together make Python code extremely easy to gloss over. I don't know much about usability studies, but my pet theory is that every bit of line noise is a tiny little hurdle, something that requires a few extra brain cycles to figure out what's going on.
Of course, readability goes hand in hand with the ability to understand code. Python does its best there, too; it would be much less readable if the language was highly irregular, inconsistent or context-sensitive. But that is something for another day...
In spite of the impression some people might get when reading this weblog, I am not against all proposed changes to Python.
Here's one I like: an extra keyword for list.sort() to support the common "decorate-sort-undecorate" idiom. (python-dev discussion; start here) This feature is small, non-intrusive, and very useful. When added to tutorials, it will also teach newbies to do the right thing (as opposed to teaching them the D-S-U idiom, which is clumsy). Also, if you don't know the idiom, you're likely to use a comparison function and run into performance problems for large lists. This makes this feature non-trivial.
The aforementioned thread has interesting stuff, besides the proposal; why DSU in its regular form is a bad choice for sorting large lists of database keys, for example (the correct way to do it is provided as well).
Also, a (possibly misquoted) saying attributed to Tim Peters:
Adding trivial functions is a net loss because the burden of learning or becoming aware of them (and their implementation nuances) will far exceed the microscopic benefit of saving a line or two that could be coded on the spot as needed.
This is exactly the problem I have with adding things like
list.sorted comes from another discussion about list.sort (starts here). Interesting quotes here too:
Since gouramis are labyrinth fish as well (like bettas), I wonder if that means that you can keep them in a bowl as well? Without a filter and all that good stuff? This site seems to think so. (Although the guy says you don't have to change the water at all; I wouldn't go that far.) AquariumFish recommends an aquarium, though.