Tao of the Machine

Programming, Python, my projects, card games, books, music, Zoids, bettas, manga, cool stuff, and whatever comes to mind.

I Testipied, my mama cried *

I uploaded the first version (1.0a1) of my testing framework. Download it here. To see how it works, read this.

This is an alpha version. More errors will probably be found once I start using it seriously. :)

Posted by Hans Nowak on 2003-06-20 21:48:15   {link}
Categories: Python


I haven't read python-dev for a while, so I wasn't aware of the new sum builtin they sneaked (snuck?) in (see here).

So what's wrong with

def sum(lst):
    import operator
    return reduce(operator.add, lst)
...? It takes strings too, or any objects that can be added. Sure, it raises an exception for any empty sequence... which is not counter-intuitive, IMHO, since there simply is nothing to add. If you disagree, a default argument is easily added:
>>> def sum(lst, default=None):
    import operator
        return reduce(operator.add, lst)
    except TypeError:
        return default

>>> sum(range(10))
>>> sum([]) # None
>>> sum([], 0)
Another builtin added that has only a marginal (if any) value over rolling your own function. That's not all, though. If we're going to add a sum function, then where is average? Or statistical functions (standard deviation, etc)? Maybe it would have been a better solution to add a module to the standard library with such functions, including sum, implemented in pure Python.

It's not very important all by itself, but slowly but surely the language becomes bloated. emoticon:nooo

Posted by Hans "aan de andere kant, de beste stuurlui staan aan wal" Nowak on 2003-06-19 18:46:47   {link}
Categories: Python


1. This seems like an interesting book. Comes with cards (I hope)...

2. Textile is causing more problems than it's worth. I am considering writing my own format, probably very minimal(istic), and then use macros for additional power. Reinventing one wheel, or two, three, what's the difference? emoticon:smile (I will keep Textile in Kaa and Firedrop2, after all, it's already there, but it's up to the user to work around all its little idiosyncracies.)

3. Firedrop2: I fixed the problem with macros that showed up unexpanded in RSS. A bleeding-edge version should be available soon.

4. Googling for 'python nederland' yields a bunch of crap. There's an opportunity here for Dutch Pythonistas...

Update (2003.07.10): Hum, now *I* am the number one hit for 'python nederland'. That wasn't so difficult. I wonder if it's possible/viable/useful to make a page with Dutch Python resources?

Posted by Hans Nowak on 2003-06-18 21:13:03   {link}
Categories: books, Firedrop

Drinking sand

I am working on a simple testing framework, that can do one or two things PyUnit can’t. (Or if it can, I haven’t been able to find out how. :-) More on this later.

In the meantime, check out the updated links page. 384 URLs now, and counting…

Posted by Hans Nowak on 2003-06-18 00:32:57   {link}
Categories: Python

Oh, please...

On a whim, I just Googled for “best site on the internet”. Guess where I ended up… emoticon:pukey

In other Google news, I also did a search for “gainesville bettas”, but I ended up on my own site. emoticon:bonk

Posted by Hans "i like those emoticons :-)" Nowak on 2003-06-17 00:18:21   {link}
Categories: general


“An invisible red thread connects those destined to meet, regardless of time, place, or circumstance. The thread may stretch or tangle, but never break.” – Chinese Proverb

(I got this quote from http://bitworking.org/news/Do_Not_Touch_The_Tools" title="">this page at http://bitworking.org/" title="">bitworking.org, which contains a disturbing story. ::cringe::)

Posted by Hans "snip snip" Nowak on 2003-06-15 18:44:42   {link}
Categories: general

Mo' bettas

OK, I don’t want to make this website too campy… but I would like to talk about some of my bettas.

As I stated before, bettas are not ordinary fish. They can do more than just pointlessly swim around and eat.

Let’s challenge the ordinary notions about fish. Do you think a fish could be “caring”? “Lazy” or “industrious”? “Enthusiastic”? Happy or sad then, maybe?

Bettas can act like all the above, and more. Of course, it’s possible that I am inappropriately projecting human emotions and traits on fish… then again, it’s possible that I am not.

For those who don’t know, here is how a betta spawn works: the male wraps around the female, squeezing the eggs out of her, and fertilizing them. He then picks up the eggs and places them in a bubblenest made for this purpose. After the spawn, the female is usually removed, since it is the male who take care of the eggs and the fry when they are born.

Mello Yello 1) was a yellow male, who spawned with Blooper, a (mostly) blue female. The encounter yielded hundreds of eggs, and the little fish worked like a horse to put the eggs in the bubblenest, and to keep them there. After a day or so, the first eggs started hatching. Fry can’t swim very well the first 2–3 days, and it is the task of the male to pick up falling fry and put them back in the nest (where they live off the remaining egg yolk). Since there were so many fry, Mello literally worked tirelessly, day and night, to keep the fry where they belonged.

After a day or three, the fry could swim horizontally (also called “free swimming”) and we removed Mello; it’s recommended to do so, and he needed a break anyway. Unfortunately, he got all depressed and droopy after that, just sat in his corner and didn’t want to eat. Eventually he died.

We only did one other spawn after that, with the same female, and Funky, a male who earned his name because of the funky colors he has (shades of blue, pink, some yellowish…). This spawn yielded not quite as many eggs, maybe 80 or so, and Funky’s behavior didn’t help. emoticon:smile Where Mello Yello worked without stopping, Funky often just sat there, looking the other way when fry were falling, and he didn’t appear so interested.

Vesta was a pink/red cambodian female (pink body, red fins and tail) and my favorite fish so far. She was the first betta I could appropriately describe as “enthusiastic”. And playful, too… sometimes she was seen chasing her own tail, like a puppy, around the stone in her tank. She did more peculiar things, like trying to make a bubblenest when she dropped (unfertilized, since no male was around) eggs. (Normally the male makes the bubblenest; it’s unusual for females.)

Sure, bettas are not comparable to dogs or cats. But next time you think of them as “just a fish”, maybe you need to readjust that notion. They are more complex, and more interesting, than you might think.

1) If you think my fish names are cheezy, check out some of the betta sites on the Net, and see what others name their fish.
Posted by Hans Nowak on 2003-06-14 21:55:51   {link}
Categories: bettas

Deja vu

Firedrop2 now supports macros. One of these days there will also be a development version available for download, but I want to write some (minimal) documentation first.

The macro system is not all-powerful (there’s embedded code for that), but nifty and easy to use. emoticon:coool (It powers these smileys, for example.) I am wondering if syntax like {URL;http://something.com;description} can be used as some kind of alternate markup… or maybe it could complement it.

More about this later.

Posted by Hans Nowak on 2003-06-14 19:51:47   {link}
Categories: Firedrop

An experiment


Update (2003–06-20). Success.

Posted by Hans "kukeledorus" Nowak on 2003-06-14 19:47:10   {link}
Categories: general

Generated by Firedrop2.