pyccel.utilities.metaclasses module

Contents

pyccel.utilities.metaclasses module#

Module containing metaclasses which are useful for the rest of pyccel

class pyccel.utilities.metaclasses.Singleton(name, bases, dct)[source]#

Bases: type

Metaclass indicating that there is only one instance of the class.

A metaclass which ensures that only one instance of the class is ever created. Trying to create a second instance will result in accessing the first.

Parameters:
  • name (str) – The name of the class.

  • bases (tuple[class,...]) – A tuple of the superclasses of the class.

  • dct (dict) – A dictionary of the class attributes.