{"id":323246,"date":"2021-05-17T15:00:26","date_gmt":"2021-05-17T15:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=323246"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=323246","title":{"rendered":"\u0424\u0443\u043d\u043a\u0446\u0438\u044f property() \u0432 Python"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/rtuI\/\">&#171;<strong>Python Developer. Basic<\/strong>&#171;<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u0434\u0432\u0443\u0445\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432 <a href=\"https:\/\/otus.pw\/LvI5\/\"><strong>\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter\u00bb<\/strong><\/a>. \u041d\u0430 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0432\u044b\u043a\u0438 \u0431\u044d\u043a\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 Python, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter. \u041f\u043e \u0438\u0442\u043e\u0433\u0430\u043c 2\u0445 \u0434\u043d\u0435\u0439 \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0432\u0435\u0441\u0442\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0432\u0430\u043b\u044e\u0442\u0443. \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c!<\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d48\/f17\/b1a\/d48f17b1a7f3ceaa4e6020bf9bde5b03.png\" width=\"780\" height=\"439\"><figcaption><\/figcaption><\/figure>\n<hr>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>property()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>property()<\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u043d \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Java \u0438 C#.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>property()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u044b <code>get<\/code>, <code>set<\/code> \u0438 <code>delete<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>property<\/code>.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>property()<\/code> \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>property<\/code> (<a href=\"https:\/\/www.tutorialsteacher.com\/python\/property-decorator\"><u>https:\/\/www.tutorialsteacher.com\/python\/property-decorator<\/u><\/a>).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ab7\/e8f\/8ee\/ab7e8f8eec14c70b6f8244e73e7439b8.png\" width=\"726\" height=\"78\"><figcaption><\/figcaption><\/figure>\n<p>    \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ol>\n<li>\n<p><code>fget<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.&nbsp;<\/p>\n<\/li>\n<li>\n<p><code>fset<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<li>\n<p><code>fdel<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<li>\n<p><code>doc<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0421\u0442\u0440\u043e\u043a\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/strong><\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0435\u0442\u0442\u0435\u0440\u0430, \u0441\u0435\u0442\u0442\u0435\u0440\u0430 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 Python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>property()<\/code>.<\/p>\n<pre><code class=\"python\">class person:     def __init__(self):         self.__name=''     def setname(self, name):         print('setname() called')         self.__name=name     def getname(self):         print('getname() called')         return self.__name     name=property(getname, setname)<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 <code>property(getname, setname)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0435\u043c\u0443 \u0438\u043c\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>name<\/code> \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>__name<\/code>. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name <\/code>\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>getname()<\/code> \u0438\u043b\u0438 <code>setname()<\/code><em>, <\/em>\u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from person import person &gt;&gt;&gt; p1=person() &gt;&gt;&gt; p1.name=\"Steve\" setname() called &gt;&gt;&gt; p1.name getname() called 'Steve'<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0432\u044b\u0448\u0435, \u043c\u0435\u0442\u043e\u0434 <code>getname()<\/code><em> <\/em>\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name<\/code>. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u0435\u0442\u043e\u0434 <code>setname<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name<\/code>. \u041e\u043d \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>__name<\/code>.<\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u0430\u043a \u0432 \u043a\u043e\u0434\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">class person:     def __init__(self, name):         self.__name=name     def setname(self, name):         print('setname() called')         self.__name=name     def getname(self):         print('getname() called')         return self.__name     def delname(self):         print('delname() called')         del self.__name     # Set property to use get_name, set_name     # and del_name methods     name=property(getname, setname, delname)<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>delname()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>name<\/code>.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from person import person &gt;&gt;&gt; p1=person() &gt;&gt;&gt; p1.name=\"Steve\" setname() called &gt;&gt;&gt; del p1.name delname() called<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>property()<\/code> \u0432 Python.<\/p>\n<p>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>@property<\/code> \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>property()<\/code>.<\/p>\n<hr>\n<blockquote>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u0443\u0440\u0441\u0435 <a href=\"https:\/\/otus.pw\/rtuI\/\">&#171;<strong>Python Developer. Basic<\/strong>&#171;<\/a><\/p>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0434\u0432\u0443\u0445\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432 <strong>\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter\u00bb<\/strong>: <a href=\"https:\/\/otus.pw\/LvI5\/\"><strong>\u0414\u0435\u043d\u044c 1<\/strong><\/a>, <a href=\"https:\/\/otus.pw\/kU1q\/\"><strong>\u0414\u0435\u043d\u044c 2.<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/557804\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/557804\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<blockquote>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u043d\u043b\u0430\u0439\u043d-\u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/otus.pw\/rtuI\/\">&#171;<strong>Python Developer. Basic<\/strong>&#171;<\/a>.<\/p>\n<p>\u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u0432\u0441\u0435\u0445 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u0434\u0432\u0443\u0445\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432 <a href=\"https:\/\/otus.pw\/LvI5\/\"><strong>\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter\u00bb<\/strong><\/a>. \u041d\u0430 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0432\u044b\u043a\u0438 \u0431\u044d\u043a\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 Python, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u043d\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter. \u041f\u043e \u0438\u0442\u043e\u0433\u0430\u043c 2\u0445 \u0434\u043d\u0435\u0439 \u0441\u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0432\u0435\u0441\u0442\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043d\u044b \u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0432\u0430\u043b\u044e\u0442\u0443. \u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0442\u0435\u0441\u044c!<\/p>\n<\/blockquote>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<hr>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>property()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0430\u0445.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>property()<\/code> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u041e\u043d \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0442\u043e\u043c\u0443, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Java \u0438 C#.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>property()<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u044b <code>get<\/code>, <code>set<\/code> \u0438 <code>delete<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>property<\/code>.<\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>property()<\/code> \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>property<\/code> (<a href=\"https:\/\/www.tutorialsteacher.com\/python\/property-decorator\"><u>https:\/\/www.tutorialsteacher.com\/python\/property-decorator<\/u><\/a>).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>    \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ol>\n<li>\n<p><code>fget<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.&nbsp;<\/p>\n<\/li>\n<li>\n<p><code>fset<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<li>\n<p><code>fdel<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<li>\n<p><code>doc<\/code>: (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e) \u0421\u0442\u0440\u043e\u043a\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e None.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439:<\/strong><\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0435\u0442\u0442\u0435\u0440\u0430, \u0441\u0435\u0442\u0442\u0435\u0440\u0430 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 Python \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>property()<\/code>.<\/p>\n<pre><code class=\"python\">class person:     def __init__(self):         self.__name=''     def setname(self, name):         print('setname() called')         self.__name=name     def getname(self):         print('getname() called')         return self.__name     name=property(getname, setname)<\/code><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 <code>property(getname, setname)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0435\u043c\u0443 \u0438\u043c\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>name<\/code> \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>__name<\/code>. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name <\/code>\u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>getname()<\/code> \u0438\u043b\u0438 <code>setname()<\/code><em>, <\/em>\u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from person import person &gt;&gt;&gt; p1=person() &gt;&gt;&gt; p1.name=\"Steve\" setname() called &gt;&gt;&gt; p1.name getname() called 'Steve'<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0432\u044b\u0448\u0435, \u043c\u0435\u0442\u043e\u0434 <code>getname()<\/code><em> <\/em>\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name<\/code>. \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u0435\u0442\u043e\u0434 <code>setname<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <code>name<\/code>. \u041e\u043d \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>__name<\/code>.<\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u0430\u043a \u0432 \u043a\u043e\u0434\u0435 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">class person:     def __init__(self, name):         self.__name=name     def setname(self, name):         print('setname() called')         self.__name=name     def getname(self):         print('getname() called')         return self.__name     def delname(self):         print('delname() called')         del self.__name     # Set property to use get_name, set_name     # and del_name methods     name=property(getname, setname, delname)<\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>delname()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>name<\/code>.<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; from person import person &gt;&gt;&gt; p1=person() &gt;&gt;&gt; p1.name=\"Steve\" setname() called &gt;&gt;&gt; del p1.name delname() called<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>property()<\/code> \u0432 Python.<\/p>\n<p>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>@property<\/code> \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>property()<\/code>.<\/p>\n<hr>\n<blockquote>\n<p>\u0423\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u0443\u0440\u0441\u0435 <a href=\"https:\/\/otus.pw\/rtuI\/\">&#171;<strong>Python Developer. Basic<\/strong>&#171;<\/a><\/p>\n<p>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0434\u0432\u0443\u0445\u0434\u043d\u0435\u0432\u043d\u044b\u0439 \u043e\u043d\u043b\u0430\u0439\u043d-\u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432 <strong>\u00ab\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0435\u0441\u043a\u0442\u043e\u043f-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Tkinter\u00bb<\/strong>: <a href=\"https:\/\/otus.pw\/LvI5\/\"><strong>\u0414\u0435\u043d\u044c 1<\/strong><\/a>, <a href=\"https:\/\/otus.pw\/kU1q\/\"><strong>\u0414\u0435\u043d\u044c 2.<\/strong><\/a><\/p>\n<\/blockquote>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/557804\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/557804\/<\/a><br \/><\/br><\/br><\/hr>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-323246","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=323246"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/323246\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}