美文网首页
2020-03-14-非常牛的写法,python的propert

2020-03-14-非常牛的写法,python的propert

作者: AI_Finance | 来源:发表于2020-03-14 17:40 被阅读0次
class Test(object):
    crawlers = property(
        lambda self: self.tt,
        doc="Set of :class:`crawlers <scrapy.crawler.Crawler>` started by "
            ":meth:`crawl` and managed by this class."
    )

    def __init__(self):
        self.tt = set()

    def runt(self):
        self.crawlers.add("11")


if __name__ == "__main__":
    t = Test()
    t.runt()
    print(t.crawlers)

相关文章

网友评论

      本文标题:2020-03-14-非常牛的写法,python的propert

      本文链接:https://www.haomeiwen.com/subject/rxmgshtx.html