Sobes.tech
Junior — Senior

Code performance improvement: class with overridden methods and list transformation to uppercase

livecode

Task condition

How can the code snippet below be made more efficient? It defines a class with overridden __hash__ and __eq__ methods, and also converts list elements to uppercase.

class HashableItem:
    def __hash__(self):
        return 42

    def __eq__(self, other):
        return True

result = []
for word in source:
    result.append(word.upper())

Consider what changes could reduce the number of operations, improve readability, and decrease memory usage.