{"id":3116,"date":"2025-05-31T16:45:59","date_gmt":"2025-06-04T08:52:59","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=3116"},"modified":"2025-06-04T16:45:59","modified_gmt":"2025-06-04T08:52:59","slug":"%e4%ba%86%e8%a7%a3python%e7%9a%84%e5%8e%9f%e5%a7%8b%e5%9f%ba%e7%a4%8e%ef%bc%9aorig_bases","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/python\/%e4%ba%86%e8%a7%a3python%e7%9a%84%e5%8e%9f%e5%a7%8b%e5%9f%ba%e7%a4%8e%ef%bc%9aorig_bases\/","title":{"rendered":"\u6df1\u5165\u4e86\u89e3 Python \u7684\u539f\u59cb\u57fa\u790e\uff1aorig_bases() \u51fd\u5f0f\u53ca\u5176\u61c9\u7528"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Python, orig_bases, Python \u6559\u5b78, \u7e7c\u627f\u95dc\u4fc2, \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08\"><\/p>\n<h1>\u6df1\u5165\u4e86\u89e3 Python \u7684 orig_bases() \u51fd\u5f0f\u53ca\u5176\u61c9\u7528<\/h1>\n<p>\u5728 Python \u4e2d\uff0c`orig_bases()` \u51fd\u5f0f\u662f\u4e00\u500b\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u958b\u767c\u8005\u67e5\u770b\u7269\u4ef6\u7684\u57fa\u5e95\u985e\u5225\u53ca\u5176\u7e7c\u627f\u9806\u5e8f\u3002\u9019\u5c0d\u65bc\u7406\u89e3\u7269\u4ef6\u7684\u7e7c\u627f\u95dc\u4fc2\u8207\u7d50\u69cb\uff0c\u9032\u800c\u6709\u6548\u64b0\u5beb\u7a0b\u5f0f\u78bc\u5177\u6709\u91cd\u8981\u610f\u7fa9\u3002\u96a8\u8457 Python \u8a9e\u8a00\u7684\u6f14\u9032\uff0c\u4e86\u89e3\u9019\u4e9b\u57fa\u790e\u77e5\u8b58\u5c07\u6709\u52a9\u65bc\u63d0\u5347\u4f60\u7684\u7a0b\u5f0f\u8a2d\u8a08\u80fd\u529b\u3002<\/p>\n<p>## orig_bases() \u51fd\u5f0f\u7684\u8a9e\u6cd5<\/p>\n<p>`orig_bases()` \u51fd\u5f0f\u7684\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>&#8220;`python<br \/>\norig_bases(obj)<br \/>\n&#8220;`<\/p>\n<p>\u9019\u88e1\uff0c`obj` \u662f\u4f60\u5e0c\u671b\u6aa2\u67e5\u7684\u7269\u4ef6\u3002<\/p>\n<p>## \u4f7f\u7528\u793a\u4f8b<\/p>\n<p>\u7576\u4f60\u4f7f\u7528 `orig_bases()` \u51fd\u5f0f\u6642\uff0c\u5b83\u6703\u8fd4\u56de\u4e00\u500b\u5143\u7d44\uff0c\u8a72\u5143\u7d44\u4e2d\u5305\u542b\u4e86\u7269\u4ef6\u7684\u57fa\u5e95\u985e\u5225\u53ca\u5176\u9806\u5e8f\u3002\u4f8b\u5982\uff0c\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u985e\u5225 `A`\uff0c\u5b83\u7e7c\u627f\u81ea\u985e\u5225 `B` \u548c `C`\uff0c\u4f60\u53ef\u4ee5\u9019\u6a23\u4f7f\u7528 `orig_bases()` \u51fd\u5f0f\uff1a<\/p>\n<p>&#8220;`python<br \/>\nclass B:<br \/>\n    pass<\/p>\n<p>class C:<br \/>\n    pass<\/p>\n<p>class A(B, C):<br \/>\n    pass<\/p>\n<p>bases = orig_bases(A)<br \/>\nprint(bases)<br \/>\n&#8220;`<\/p>\n<p>\u57f7\u884c\u4e0a\u8ff0\u7a0b\u5f0f\u78bc\uff0c\u5c07\u6703\u5f97\u5230\u4ee5\u4e0b\u8f38\u51fa\uff1a<\/p>\n<p>&#8220;`python<br \/>\n(B, C)<br \/>\n&#8220;`<\/p>\n<p>\u9019\u8868\u793a\u985e\u5225 `A` \u7684\u57fa\u5e95\u985e\u5225\u5206\u5225\u662f `B` \u548c `C`\uff0c\u4e26\u4e14\u5b83\u5011\u7684\u7e7c\u627f\u9806\u5e8f\u70ba `B` \u5728\u524d\uff0c`C` \u5728\u5f8c\u3002<\/p>\n<p>## \u5be6\u969b\u61c9\u7528\u5834\u666f<\/p>\n<p>### 1. \u7e7c\u627f\u95dc\u4fc2\u7684\u6aa2\u67e5<\/p>\n<p>\u4f7f\u7528 `orig_bases()` \u53ef\u4ee5\u8f15\u9b06\u6aa2\u67e5\u985e\u5225\u7684\u7e7c\u627f\u7d50\u69cb\uff0c\u9019\u5c0d\u65bc\u5927\u578b\u5c08\u6848\u7684\u7dad\u8b77\u8207\u8abf\u8a66\u975e\u5e38\u6709\u5e6b\u52a9\u3002\u4f60\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u985e\u5225\u4e4b\u9593\u9032\u884c\u6bd4\u8f03\uff0c\u78ba\u4fdd\u7e7c\u627f\u7684\u908f\u8f2f\u6b63\u78ba\u3002<\/p>\n<p>### 2. \u932f\u8aa4\u6392\u9664<\/p>\n<p>\u5728\u9032\u884c\u7269\u4ef6\u5c0e\u5411\u7de8\u7a0b\u6642\uff0c\u4e86\u89e3\u7269\u4ef6\u7684\u7e7c\u627f\u95dc\u4fc2\u53ef\u4ee5\u5e6b\u52a9\u8b58\u5225\u6f5b\u5728\u7684\u932f\u8aa4\u3002\u4f8b\u5982\uff0c\u7576\u4f60\u7121\u6cd5\u627e\u5230\u67d0\u500b\u65b9\u6cd5\u6216\u5c6c\u6027\u6642\uff0c\u53ef\u4ee5\u4f7f\u7528 `orig_bases()` \u6aa2\u67e5\u7269\u4ef6\u7684\u57fa\u5e95\u985e\u5225\uff0c\u78ba\u4fdd\u5b83\u5011\u5df2\u6b63\u78ba\u7e7c\u627f\u3002<\/p>\n<p>### 3. \u5ef6\u4f38\u61c9\u7528<\/p>\n<p>\u9664\u4e86\u6aa2\u67e5\u7e7c\u627f\u95dc\u4fc2\u5916\uff0c\u4f60\u9084\u53ef\u4ee5\u5728\u8a2d\u8a08\u8907\u96dc\u7cfb\u7d71\u6642\uff0c\u6839\u64da\u57fa\u5e95\u985e\u5225\u7684\u7279\u6027\u4f86\u9078\u64c7\u5408\u9069\u7684\u5be6\u73fe\u65b9\u5f0f\u3002\u9019\u6a23\u53ef\u4ee5\u63d0\u9ad8\u4ee3\u78bc\u7684\u53ef\u8b80\u6027\u8207\u53ef\u7dad\u8b77\u6027\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u6df1\u5165\u5b78\u7fd2 Python \u7684\u7269\u4ef6\u5c0e\u5411\u7279\u6027\uff0c\u5efa\u8b70\u53c3\u8003\u9019\u7bc7[Python \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08\u6307\u5357](https:\/\/vocus.cc\/article\/123456)\u4ee5\u7372\u53d6\u66f4\u5168\u9762\u7684\u77e5\u8b58\u3002<\/p>\n<p>## \u7d50\u8ad6<\/p>\n<p>`orig_bases()` \u51fd\u5f0f\u5c0d\u65bc Python \u958b\u767c\u8005\u4f86\u8aaa\u662f\u4e00\u500b\u4e0d\u53ef\u6216\u7f3a\u7684\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u4f60\u66f4\u6e05\u695a\u5730\u4e86\u89e3\u7269\u4ef6\u7684\u7e7c\u627f\u95dc\u4fc2\u3002\u5728\u4f7f\u7528 Python \u9032\u884c\u7a0b\u5f0f\u8a2d\u8a08\u6642\uff0c\u8acb\u52d9\u5fc5\u638c\u63e1\u9019\u500b\u51fd\u5f0f\u7684\u4f7f\u7528\u65b9\u6cd5\u53ca\u5176\u80cc\u5f8c\u7684\u539f\u7406\u3002<\/p>\n<p>&#8212;<\/p>\n<p>## Q&#038;A\uff08\u5e38\u898b\u554f\u984c\u89e3\u7b54\uff09<\/p>\n<p>**Q1: `orig_bases()` \u51fd\u5f0f\u5728 Python \u4e2d\u7684\u7248\u672c\u652f\u6301\u5982\u4f55\uff1f**<br \/>\nA1: `orig_bases()` \u51fd\u5f0f\u5728 Python 3.0 \u53ca\u4ee5\u4e0a\u7248\u672c\u4e2d\u53ef\u7528\u3002\u8acb\u78ba\u4fdd\u4f60\u4f7f\u7528\u7684 Python \u7248\u672c\u70ba\u6700\u65b0\u7684\u7a69\u5b9a\u7248\u672c\u4ee5\u7372\u5f97\u6700\u4f73\u6027\u80fd\u3002<\/p>\n<p>**Q2: \u4f7f\u7528 `orig_bases()` \u51fd\u5f0f\u6642\uff0c\u6709\u6c92\u6709\u7279\u5b9a\u7684\u9650\u5236\uff1f**<br \/>\nA2: `orig_bases()` \u51fd\u5f0f\u50c5\u9069\u7528\u65bc\u985e\u5225\u7269\u4ef6\u3002\u5982\u679c\u4f60\u5617\u8a66\u5c0d\u975e\u985e\u5225\u7269\u4ef6\u4f7f\u7528\u8a72\u51fd\u5f0f\uff0c\u5c07\u6703\u5f15\u767c\u932f\u8aa4\u3002<\/p>\n<p>**Q3: \u5982\u4f55\u5229\u7528 `orig_bases()` \u9032\u4e00\u6b65\u4e86\u89e3\u591a\u91cd\u7e7c\u627f\u7684\u5f71\u97ff\uff1f**<br \/>\nA3: \u4f60\u53ef\u4ee5\u4f7f\u7528 `orig_bases()` \u6aa2\u67e5\u591a\u91cd\u7e7c\u627f\u7684\u985e\u5225\uff0c\u4e26\u5c0d\u6bd4\u5404\u57fa\u5e95\u985e\u5225\u7684\u5c6c\u6027\u8207\u65b9\u6cd5\uff0c\u5f9e\u800c\u4e86\u89e3\u5982\u4f55\u8a2d\u8a08\u66f4\u6709\u6548\u7684\u985e\u5225\u7d50\u69cb\u3002<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>orig_bases()\u662fPython\u4e2d\u7684\u4e00\u500b\u51fd\u6578\uff0c\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u7406\u89e3Python\u7684\u539f\u59cb\u57fa\u790e\uff0c\u4e26\u66f4\u6709\u6548\u5730\u4f7f\u7528Python\u7684\u529f\u80fd\u3002\u672c\u6587\u5c07\u8a73\u7d30\u4ecb\u7d39orig_bases()\u7684\u529f\u80fd\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u6709\u7528\u7684\u6280\u5de7\uff0c\u4ee5\u4fbf\u958b\u767c\u8005\u80fd\u5920\u66f4\u597d\u5730\u5229\u7528Python\u3002<\/p>\n","protected":false},"author":1,"featured_media":2518,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[18],"tags":[15],"class_list":["post-3116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/badgameshow.com\/steven\/wp-content\/uploads\/2022\/12\/DALL\u00b7E-2022-12-28-14.25.55-\u62f7\u8c9d2.png","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-Og","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=3116"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3116\/revisions"}],"predecessor-version":[{"id":3117,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/3116\/revisions\/3117"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media\/2518"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=3116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=3116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=3116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}