Solved by ptrblck in post #2 
              
              
                The indentation of __getitem__ and __len__ is wrong, as both methods are defined inside the __init__ function. 
Move them one level to the left and it should work.