0

Does CPython checks field name char by char when we access field? For example:

some_object.field_name = value

How does CPython resolve name field_name? Does it generate hash-code? Or all strings have some id?

  • 2
    Compile time strings are "interned". That removes duplicates and string comparison can be achieved with a simple pointer comparison. See https://stackoverflow.com/questions/15541404/python-string-interning – Homer512 Oct 07 '22 at 10:37

0 Answers0