As I mentioned in my previous blog post I’ve been hacking on a product taxonomy and I wanted to create a ‘CHILD’ relationship between a collection of categories.
For example, I had the following array and I wanted to transform it into an array of ‘SubCategory, Category’ pairs:
taxonomy = ["Cat", "SubCat", "SubSubCat"] # I wanted this to become [("Cat", "SubCat"), ("SubCat", "SubSubCat")
In order to do this we need to zip the first 2 items with the last which I found reasonably easy to do using Python:


