Save a lot of memory with __slots__ and generators and other tricks