Demo entry 6350552

a

   

Submitted by anonymous on Mar 13, 2017 at 05:20
Language: Python 3. Code size: 187 Bytes.

def singleton(cls):
    instances={}
    def getinstance():
        if cls not in instances():
            instances[cls] = cls()
        return instance[cls]
    return getinstance

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).