← Back to Python

__slots__

Pythonpython

The Question

What are __slots__ and why would you use them?

What a Strong Answer Covers

  • prevents __dict__
  • "less memory
  • "no dynamic attributes

Related Questions

  • GIL — What It Is and What It Protects
  • ThreadPoolExecutor & ProcessPoolExecutor
  • Decorators — Under the Hood
  • Generators & yield
  • Context Managers

Practice This Question

Get AI-graded feedback on your answer with follow-up probes on weak points.

Take the Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout