{"id":1030,"date":"2022-01-28T14:59:33","date_gmt":"2022-01-28T06:59:33","guid":{"rendered":"http:\/\/www.eait.co\/?p=1030"},"modified":"2022-01-28T15:04:14","modified_gmt":"2022-01-28T07:04:14","slug":"python%e8%a3%85%e9%a5%b0%e5%99%a8","status":"publish","type":"post","link":"https:\/\/notes.coremix.net\/?p=1030","title":{"rendered":"python\u88c5\u9970\u5668"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"569\" class=\"alignnone wp-image-1031 size-full\" src=\"http:\/\/www.eait.co\/wp-content\/uploads\/2022\/01\/Pasted-8.png\" srcset=\"https:\/\/notes.coremix.net\/wp-content\/uploads\/2022\/01\/Pasted-8.png 756w, https:\/\/notes.coremix.net\/wp-content\/uploads\/2022\/01\/Pasted-8-300x226.png 300w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nclass Rectangle:\r\n\r\n    def __init__(self, length, width):\r\n        self.length = length\r\n        self.width = width\r\n\r\n    def area(self):\r\n        areas = self.length * self.width\r\n        return areas\r\n\r\n    @property  \t# \u5c31\u50cf\u8bbf\u95ee\u5c5e\u6027\u4e00\u6837\r\n    def area(self):\r\n        return self.width * self.length\r\n\r\n    @staticmethod  \t# \u9759\u6001\u65b9\u6cd5  \u548cclass\u7c7b\u65ad\u5f00\u8054\u7cfb\r\n    def func():  \t# self  \u5728\u8c03\u7528\u7684\u65f6\u5019\u4f1a\u62a5\u9519\r\n        print(\u2018staticmethod func\u2019)\r\n\r\n    @classmethod  \t# \u7c7b\u65b9\u6cd5 \r\n    def show(cls):  \t# cls \u4ee3\u8868\u7c7b\u672c\u8eab \r\n        print(cls)\r\n        print('show fun')\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u7c7b\u88c5\u9970\u5668<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nclass Test_Class:\r\n    def __init__(self, func):\r\n        self.func = func\r\n\r\n    def __call__(self):\r\n        print('\u7c7b')\r\n        return self.func\r\n\r\n@Test_Class\r\ndef fun_test():\r\n    print('\u8fd9\u662f\u4e2a\u6d4b\u8bd5\u51fd\u6570')\r\n<\/pre>\n<p><b>\u9700\u8981\u5b9a\u4e49 __call__ \u65b9\u6cd5<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>class Rectangle: def __init__(self, length, width): sel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-1030","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-python"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1030"}],"version-history":[{"count":4,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1030\/revisions"}],"predecessor-version":[{"id":1035,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/1030\/revisions\/1035"}],"wp:attachment":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}