''' Created on Sep 17, 2015 @author: Brett Paufler Copyright Brett Paufler Yes, I hate throwing intellectual work away. It is what I am. This is a worksheet area for my Python Weekly Code Snippets webpage Likely, nothing in here is long term critical PACK IT UP EVERY WEEK Into non-executing functions and classes ''' from copy import deepcopy from itertools import cycle #a = [[1, 2, 3], [4, 5, 6]] class FlatList(): def __init__(self, a): self.list = deepcopy(a) self.flat = [item for sublist in self.list for item in sublist] self.head = self.list[0] self.tail = self.list[1:] def __iter__(self): for i in self.flat: yield i def toggle(self, a=cycle([True, False])): return next(a) def toggle(a=cycle([True, False])): return next(a) #print toggle(), toggle(), toggle() ''' END WEEK #1 - Let's see how long this lasts '''