python-xss攻击和单例模式

1.python中单例模式

class Foo:
    instance = None

    def __new__(cls, *args, **kwargs):
        if not Foo.instance:
            Foo.instance = object.__new__(cls,*args,**kwargs)
            return Foo.instance
        else:
            return Foo.instance

 

posted @ 2018-08-07 19:20  土耳其大骗子  阅读(1337)  评论(1编辑  收藏  举报