Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/util/Singleton.py
blob: c1618669890b08841eb05b6210a15aac74fffd7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Singleton(object):
    _instance = None
    def __new__(cls, * args, ** kwargs):
        if not cls._instance:
            cls._instance = super(Singleton, cls).__new__(
                                                          cls, * args, ** kwargs)
        return cls._instance


if __name__ == '__main__':
    s1 = Singleton()
    s2 = Singleton()
    if s1 == s2:
        print "Same"
    else:
        print "Different"