5 ms·
AFAIK Python strings cache their hash value. All the hash table lookups for object properties should be compile-time constant strings that reuse the string obje
by ynik 3y ago
AFAIK Python strings cache their hash value. All the hash table lookups for object properties should be compile-time constant strings that reuse the string object, and thus also reuse the cached hash value.
It may take 11 hash computations for the first print("hello world"), but the second call shouldn't take any.