class_docstr: Metaclass for singleton classes.
  
  Explanation
  ===========
  
  A singleton class has only one instance which is returned every time the
  class is instantiated. Additionally, this instance can be accessed through
  the global registry object ``S`` as ``S.<class_name>``.
  
  Examples
  ========
  
      >>> from sympy import S, Basic
      >>> from sympy.core.singleton import Singleton
      >>> class MySingleton(Basic, metaclass=Singleton):
      ...     pass
      >>> Basic() is Basic()
      False
      >>> MySingleton() is MySingleton()
      True
      >>> S.MySingleton is MySingleton()
      True
  
  Notes
  =====
  
  Instance creation is delayed until the first time the value is accessed.
  (SymPy versions before 1.0 would create the instance during class
  creation time, which would be prone to import cycles.)
code: def __init__(cls, *args, **kwargs):
      cls._instance = obj = Basic.__new__(cls)
      cls.__new__ = lambda cls: obj
      cls.__getnewargs__ = lambda obj: ()
      cls.__getstate__ = lambda obj: None
      S.register(cls)
  
file_path: sympy/sympy/core/singleton.py
imports: from .core import Registry
  from .sympify import sympify
  from .basic import Basic
label_desc: Use image node_id 1 to create a new Singleton object from inherited base classes: type with example: obj = Singleton(cls)