What is the result of `sys.intern(‘hello’) is sys.intern(‘hello’)`?

Python Professional Hard

Python Professional — Hard

What is the result of `sys.intern(‘hello’) is sys.intern(‘hello’)`?

Key points

  • `sys.intern()` returns the same object for equal strings
  • This behavior ensures memory optimization
  • The comparison using `is` checks for object identity

Ready to go further?

Related questions