Monday, August 9, 2010

Reversing a string in Python

I recently purchased a new Python book, Python for Bioinformatics, by James Kinser. As I was skimming through the introductory portion of the book I came across a rather interesting piece of Python code related to slicing:

>>> st = 'I am a string'
>>> st[::-1]
'gnirts a ma I'

It never occurred to me to use slicing in this way. I'm really disappointed I managed to overlook this ability. However, should I ever run into a situation where I need to reverse the contents of a string in Python, I now know of a nice one liner. :)

It works the same with lists (and tuples and arrays):

>>> lt = ["Bob", "Ash", "Mike"]
>>> lt[::-1]
["Mike", "Ash", "Bob"]

But, if I need to reverse a list, I'll probably just stick with lt.reverse(). (Unfortunately, that strings do not have this method.)

For a more detailed explanation of why this works, check out the Python documentation on Extended Slices.

Sunday, August 8, 2010

Retro Sprite Art with Perler Beads

I finally found a craft project that I can finish easily in one sitting: 8-bit sprite art using perler beads.

I was inspired Friday when I stumbled across a post from Geek Crafts' blog, 10 Awesomely Geeky Perler Beads Crafts. Since then, I think I have become addicted to these awesomely geeky creations. XD

Fortunately, there's many classic sprites available online. Two websites that I found particularly useful were and

To help visualize where to put beads in the board, I used gimp. I just opened up my image and zoomed in about 2000%. It sucks that grid lines aren't available, but the enlarged image was enough to get the job done.

So far I've made two Mario's, a question block (from Super Mario Bros.), Kirby and Lakitu. I hope to make a project with Phoenix Wright and Domo-kun, but I need to get a larger perler bead board. :)

Here's a few more pictures of my little creations:

Pink Mario. He's so cute. :)

Finished hunger Kirby


My first blog post. Yay me.

So, about me:

I'm 23 years old.
I'm in love with this furry brown monster name Domo.
I'm a software developer living in the great state of Alabama. :)
I LOVE crafting (although I have a problem finishing projects x__x ).
Huge fan of video gaming (console gaming in particular).
I live happily with my husband and our cat, Lola.

I'm maintaining this blog to document my crafting adventures. :) And possibly a few of my software adventures.

So here's a early "thank you" for anyone out there reading this far. :)