{"id":344,"date":"2017-02-18T19:37:17","date_gmt":"2017-02-18T10:37:17","guid":{"rendered":"http:\/\/www.python.ambitious-engineer.com\/?p=344"},"modified":"2020-05-03T20:45:00","modified_gmt":"2020-05-03T11:45:00","slug":"%e3%83%97%e3%83%ad%e3%83%91%e3%83%86%e3%82%a3","status":"publish","type":"post","link":"https:\/\/www.python.ambitious-engineer.com\/archives\/344","title":{"rendered":"\u30d7\u30ed\u30d1\u30c6\u30a3"},"content":{"rendered":"<h2>\u5c5e\u6027\u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h2>\n<p>\u3053\u308c\u307e\u3067\u898b\u3066\u304d\u305f\u3088\u3046\u306b\u3001Python\u3067\u5c5e\u6027\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u969b\u306f [\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d.\u30e1\u30f3\u30d0\u540d] \u306e\u5f62\u5f0f\u3067\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u300c\u53c2\u7167\u3059\u308b\u3068\u304d\u306f\u30ab\u30c3\u30b3\u3092\u4ed8\u3051\u305f\u3044\u300d\u300c\u66f4\u65b0\u3059\u308b\u3068\u304d\u306f\u30c1\u30a7\u30c3\u30af\u3092\u3057\u305f\u3044\u300d\u300c\u524a\u9664\u51e6\u7406\u3092\u7981\u6b62\u3057\u305f\u3044\u300d\u306a\u3069\u3001\u30a2\u30af\u30bb\u30b9\u3059\u308b\u969b\u306b\u51e6\u7406\u3092\u633f\u5165\u3059\u308b\u3088\u3046\u306a\u8981\u4ef6\u304c\u3067\u3066\u304f\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u3053\u306e\u6642\u3001\u5c02\u7528\u306esetter\u3001getter\u3001deleter\u3092\u4f5c\u6210\u3059\u308b\u3068\u554f\u984c\u306f\u89e3\u6c7a\u3057\u307e\u3059\u304c\u3001\u6bce\u56de\u305d\u308c\u3089\u306e\u5c02\u7528\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u3060\u3055\u306a\u3051\u308c\u3070\u52b9\u679c\u304c\u3067\u307e\u305b\u3093\u3002\u307e\u305f\u3001\u30af\u30e9\u30b9\u3092\u5229\u7528\u3059\u308b\u5074\u304c\u304b\u306a\u3089\u305a\u305d\u308c\u3089\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5229\u7528\u3057\u3066\u304f\u308c\u308b\u4fdd\u8a3c\u3082\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nclass Sample:\r\n\r\n    def __init__(self):\r\n        self.text = &quot;sample&quot;\r\n\r\n    def get_text(self):\r\n        return &quot;({0})&quot;.format(self.text)\r\n\r\n    def set_text(self, text):\r\n        if text is None:\r\n            self.text = &quot;&quot;\r\n        else:\r\n            self.text = text\r\n\r\n    def delete_text(self):\r\n        pass\r\n        \r\n\r\n# \u3044\u3061\u3044\u3061\u5c02\u7528\u30e1\u30bd\u30c3\u30c9\u7d4c\u7531\u3067\u30a2\u30af\u30bb\u30b9\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u30fb\u30fb\u30fb\r\nobj = Sample()\r\n\r\nprint(obj.get_text())\r\n\r\nobj.set_text(None)\r\n\r\nobj.delete_text()\r\n\r\n\r\n<\/pre>\n<h2>\u30d7\u30ed\u30d1\u30c6\u30a3<\/h2>\n<p>\u3053\u308c\u3067\u306f\u3001\u305b\u3063\u304b\u304f\u306egetter\u3001setter\u306a\u3057\u3067\u6c17\u8efd\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308bPython\u306e\u7279\u5fb4\u304c\u6d3b\u304d\u3066\u304d\u307e\u305b\u3093\u3002\u3068\u3053\u308d\u304c\u3001Python\u306b\u306f\u901a\u5e38\u306e\u30a2\u30af\u30bb\u30b9\u306e\u8a18\u8ff0\u3092\u3057\u3064\u3064\u5c02\u7528\u30e1\u30bd\u30c3\u30c9\u7d4c\u7531\u3067\u51e6\u7406\u3092\u884c\u3046\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3088\u3070\u308c\u308b\u7d44\u8fbc\u307f\u30c7\u30b3\u30ec\u30fc\u30bf\u304c\u3042\u308a\u307e\u3059\u3002\u4e0a\u306e\u30b3\u30fc\u30c9\u3092\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u7528\u3044\u3066\u66f8\u304d\u306a\u304a\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nclass Sample:\r\n\r\n    def __init__(self):\r\n        self.__text = &quot;sample&quot; \r\n\r\n    @property\r\n    def text(self):\r\n        return &quot;({0})&quot;.format(self.__text)\r\n\r\n    @text.setter\r\n    def text(self, text):\r\n        if text is None:\r\n            self.__text = &quot;None&quot;\r\n        else:\r\n            self.__text = text\r\n\r\n    @text.deleter\r\n    def text(self):\r\n        pass\r\n        \r\n\r\n#  \u901a\u5e38\u306e\u30a2\u30af\u30bb\u30b9\u65b9\u6cd5\u304c\u5229\u7528\u3067\u304d\u308b\uff01\uff01\r\nobj = Sample()\r\nprint(obj.text)\r\n\r\nobj.text = None\r\nprint(obj.text)\r\n\r\ndel obj.text\r\nprint(obj.text)\r\n<\/pre>\n<p>\u901a\u5e38\u306e\u30a2\u30af\u30bb\u30b9\u3067\u5c02\u7528\u30e1\u30bd\u30c3\u30c9\u7d4c\u7531\u3067\u51e6\u7406\u304c\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u4ee5\u4e0b\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<table>\n<tr>\n<th>\u30d7\u30ed\u30d1\u30c6\u30a3<\/th>\n<th>\u5f79\u5272<\/th>\n<\/tr>\n<tr>\n<td>@property<\/td>\n<td>getter<\/td>\n<\/tr>\n<tr>\n<td>@\u5c5e\u6027\u540d.setter<\/td>\n<td>setter<\/td>\n<\/tr>\n<tr>\n<td>@\u5c5e\u6027\u540d.deleter<\/td>\n<td>deleter<\/td>\n<\/tr>\n<\/table>\n<h2>\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u6ce8\u610f\u70b9<\/h2>\n<p>\u4e0a\u306e\u30b3\u30fc\u30c9\u3067\u3059\u304c\u3001\u7591\u554f\u306b\u601d\u308f\u308c\u305f\u70b9\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\uff1f\u305d\u3046\u3001\u4fee\u6b63\u3057\u305f\u30b3\u30fc\u30c9\u306f\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u30922\u3064\u3064\u3051\u305f\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306a\u30e1\u30f3\u30d0\u540d\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002setter\u3092\u5229\u7528\u3059\u308b\u969b\u306f\u304b\u306a\u3089\u305a\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306a\u30e1\u30f3\u30d0\u306b\u3057\u306a\u3044\u3068\u3001\u7121\u9650\u518d\u5e30\u51e6\u7406\u306b\u5165\u308b\u3001\u3068\u3044\u3046\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3059\u3002\u4eee\u306b\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u306b\u3057\u306a\u3044\u5834\u5408\u3001\u5148\u307b\u3069\u306e\u51e6\u7406\u306esetter\u90e8\u5206\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nself.text = text\r\n<\/pre>\n<p>\u3053\u3053\u3067\u307e\u305f\u306bsetter\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u3055\u3089\u306bsetter\u304c\u547c\u3073\u51fa\u3055\u308c\u3001\u3001\u3001\u3068\u3044\u3046\u30eb\u30fc\u30d7\u306b\u5165\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c5e\u6027\u3078\u306e\u30a2\u30af\u30bb\u30b9 \u3053\u308c\u307e\u3067\u898b\u3066\u304d\u305f\u3088\u3046\u306b\u3001Python\u3067\u5c5e\u6027\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u969b\u306f [\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d.\u30e1\u30f3\u30d0\u540d] \u306e\u5f62\u5f0f\u3067\u8a18\u8ff0\u3057\u307e\u3057\u305f\u3002\u3067\u3059\u304c\u3001\u4f8b\u3048\u3070\u300c\u53c2\u7167\u3059\u308b\u3068\u304d\u306f\u30ab\u30c3\u30b3\u3092\u4ed8\u3051\u305f\u3044\u300d\u300c\u66f4\u65b0\u3059\u308b\u3068\u304d\u306f\u30c1\u30a7\u30c3\u30af\u3092\u3057\u305f\u3044\u300d\u300c\u524a\u9664...<\/p>\n","protected":false},"author":1,"featured_media":3680,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[103],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/344"}],"collection":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":5,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":3679,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/344\/revisions\/3679"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media\/3680"}],"wp:attachment":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}