EasyPython

Singleton

PythonDesign PatternsCreational

Singleton ensures a class has exactly one instance, shared everywhere
it's constructed.

Implement ConfigManager so that every ConfigManager() call returns the
same object, using __new__ to intercept instantiation (the idiomatic
Python way — no need for a separate get_instance() method).

solve(operations) drives it through 'set' / 'get' / 'identity_check'
ops and returns the results.

Sample tests

Test #1Set then get through a fresh "instance"
Input: [[{"op":"set","key":"theme","val":"dark"},{"op":"get","key":"theme"}]]
Output: [true,"dark"]
Test #2Missing key returns None
Input: [[{"op":"get","key":"missing"}]]
Output: [null]
Test #3Two constructions are the same object
Input: [[{"op":"identity_check"}]]
Output: [true]