arte/utils/multiton.py
def multiton(cls):
    '''
    Multiton decorator

    Decorator that returns the same instance of a class
    every time it is instantiated with the same parameters.

    All parameters must be able to be passed to str() in order
    to build an hashable key.
    As a side effect, the class name becomes a function
    that returns an instance, rather than a class type instance.
    '''
    instances = {}

    def getinstance(*args):
        key = '.'.join(map(str, args))
        if key not in instances:
            instances[key] = cls(*(args[1:]))
        return instances[key]

    return getinstance

    Multiton decorator

    Decorator that returns the same instance of a class
    every time it is instantiated with the same parameters.

    All parameters must be able to be passed to str() in order
    to build an hashable key.
    As a side effect, the class name becomes a function
    that returns an instance, rather than a class type instance.
    
Multiton decorator
Decorator that returns the same instance of a class
every time it is instantiated with the same parameters.

All parameters must be able to be passed to str() in order
to build an hashable key.
As a side effect, the class name becomes a function
that returns an instance, rather than a class type instance.
Multiton decorator Decorator that returns the same instance of a class every time it is instantiated with the same parameters . All parameters must be able to be passed to str () in order to build an hashable key . As a side effect the class name becomes a function that returns an instance rather than a class type instance .
def multiton(cls):
    instances = {}
    def getinstance(*args):
        key = '.'.join(map(str, args))
        if key not in instances:
            instances[key] = cls(*(args[1:]))
        return instances[key]
    return getinstance
def multiton ( cls ) : instances = { } def getinstance ( * args ) : key = '.' . join ( map ( str , args ) ) if key not in instances : instances [ key ] = cls ( * ( args [ 1 : ] ) ) return instances [ key ] return getinstance
Multiton decorator
Decorator that returns the same instance of a class
every time it is instantiated with the same parameters.
Multiton decorator Decorator that returns the same instance of a class every time it is instantiated with the same parameters .
'''
    Multiton decorator

    Decorator that returns the same instance of a class
    every time it is instantiated with the same parameters.

    All parameters must be able to be passed to str() in order
    to build an hashable key.
    As a side effect, the class name becomes a function
    that returns an instance, rather than a class type instance.
    '''
cls