## Utah Python Users Group - 11/11/10

I've been messing around with Python for the past 6 months and I'm loving it. Today I went to my second UtahPython users group meeting and had a lot of fun and learned a ton of stuff.

Chronological order of things I learned:
• Supy bot - an IRC bot written in Python.
• supybot-doxygen - A plugin for supy bot that can provide api documentation for any software that uses doxygen.
• This could be really useful at work if I can setup an internal IRC server for the developers to hang out.
• Objectify is a module in python for parsing XML files.
• doctest - a python module for TDD that is super simple. I'm really excited about this. Thanks to Matt for showing me how to use this.
Matt suggested that we do some pair programming during the meetup.
Here's the task: Write a simple python program that can take page numbers as user input and convert it to a list of numbers.
```User Input: 0, 1, 5, 7-10
Output: 0,1,5,7,8,9,10```
Here is the code I wrote with the doc test based unit test in the doc-string:
```###### PrintParser.py #######

#!/usr/bin/env python

def convert(inp):
"""
* Get the input from user.
* Parse the input to extract numbers
** Split by comma
*** Each item in the list will then be split by '-'
**** Populate the number between a-b using range(a,b)

>>> convert("")
[]
>>> convert("1")
[1]
>>> convert("1,2")
[1, 2]
>>> convert("1,2-5")
[1, 2, 3, 4, 5]
>>> convert("1-3,2-5,8,10,15-20")
[1, 2, 3, 2, 3, 4, 5, 8, 10, 15, 16, 17, 18, 19, 20]
"""
if not inp:
return []
pages = []
comma_separated = []
comma_separated = inp.split(",")
for item in comma_separated:
if "-" in item:
a = item.split("-")
pages.extend(range(int(a[0]),int(a[1])+1))
else:
pages.append(int(item))

return pages

if __name__ == '__main__' :
import doctest
doctest.testmod()```

## Hapkido First Impressions

I went to my first Hapkido class today. I have a very good (and respected) friend from work, who is already taking that class and he recommended it.

I had high hopes for that class, maybe a little too high. It was a little bit underwhelming due to my overtly hyped expectations. It is definitely more exerting (physically) than Aikido. It combines the kicks from Taekwondo with the joint locks in Aikido. So I'm excited to keep learning the art. But the part that bothers me about Hapkido is you attack to destroy, unlike Aikido where you take care of your opponent even when you are pinning them down and making them submit.

But one great thing about the class is the instructor seems really good. He is very friendly and knowledgeable. If you are in Lehi/American Fork area you should check out the class. xsifactory.com/martial-arts-classes/

## Mmmmm.... Rice

After three days of not having any rice, I finally made some today. Is it just me or does every one well up a little bit when they are about to taste rice?

So if I like rice so much, why don't I make some every day, you ask. Well, I'm a lazy bum who doesn't enjoy cooking as much as eating. There, I said it!

## Vita Brevis [Ars Longa]

InnerVoice: That is latin for "Life is Short, Art is Long".

Me: Yeah, I know, I'm a little behind on my personal projects.
InnerVoice: Try waaaaay behind. There are at least ten tabs open at home and five tabs open at work
Me: I'll get to it. They are not going anywhere.
InnerVoice: BTW, those unread emails with some tutorial links isn't gonna master itself, you know.
Me: Hmmm.....
InnerVoice: Are you even listening to me?
Me: Barely. I'm still thinking about my first Hapkido class tomorrow.
InnerVoice: Well, there goes the Wednesday nights.
Me: BTW, I agreed to present a brief tutorial on Git at the SLLUG meeting next Wednesday (Nov 17).
InnerVoice: What? Are you crazy?
Me: Well how else am I going to make a good first impression?
InnerVoice: You do realize, you've never been to one of those meetings, right?
Me: Yeah, but they seem like nice people. I'm sure I'll be fine.
InnerVoice: *Shakes Head* Hopeless, utterly hopeless.
Me: *Grinning with glee*

It's awesome when life gets busy.

## Movember Pics

I heard about the Movember Movement at Ignite SLC #6. I decided it is high time I use my facial hair for something useful (other than impressing the missus).

Shout out to Clark Winegar of Mustache Power for his Movember presentation @ Ignite.