Micro-optimization for get_categories() by using __slots__