A

Admin • 833K Points
Coach

Q. What is the purpose of __slots__ in Python classes?

  • (A) To increase object size
  • (B) To limit attributes for memory optimization
  • (C) To speed up inheritance
  • (D) To declare private members
  • Correct Answer - Option(B)
  • Views: 27
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

__slots__ is used to prevent creation of __dict__ and limit dynamic attributes.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.