Yay Python!

Recently, I’ve been writing some Python CGI’s for administrative interfaces (Python’s SOAP and XML-RPC interfaces are really sweet). Today I had to calculate array differences and was looking into doing it in Perl, but it turns out that it’s even easier in Python because it has set functionality built-in. Here’s how to calculate the difference of two arrays:


a_set = set(a_list)
b_set = set(b_list)
aonly = list(a_set - b_set)

Sweet!