News for hackers. Stuff that matters.
Re:Strange line of Python by densh on Friday November 18, 2011 @12:54PM (#3252618)
Python version is definetely written in perl style (pragmatic and write-only). I've rewritten it to make it readable:

https://gist.github.com/1377187

Re:Strange line of Python by BrandonM on Friday November 18, 2011 @01:59PM (#3252888)
Your version looks like a java/C# style to me. It's not really necessary to create a class for this.
Re:Strange line of Python by densh on Friday November 18, 2011 @03:41PM (#3253317)
At first I had a version that wasn't using classes but it was sort of ugly as we have relatively large state (current_states, final_states, transitions) and you have to pass it along to every other function. It looks a little bit ugly:

https://gist.github.com/1377685

Actually I'm a big fan of using plain functions whenever possible but in this case it doesn't seem to be a right solution

Re:Strange line of Python by DasIch on Friday November 18, 2011 @07:37PM (#3254153)
f.readlines() really? You can just iterate over the file.
Re:Strange line of Python by densh on Saturday November 19, 2011 @05:44AM (#3255056)
Right, I intentionally changed to .readlines() to make code clearer for people who don't really know python. (And btw explicit is better than implicit.)