← Back to Python

__new__ vs __init__

Pythonpython

The Question

What is the difference between __new__ and __init__?

What a Strong Answer Covers

  • __new__ creates
  • cls
  • "__init__ initializes
  • self
  • "immutable types/singleton

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