From 46d767278d782f6b3c8e4d3bb1fcd9ee097107c8 Mon Sep 17 00:00:00 2001 From: yicone Date: Sat, 29 Jan 2022 01:14:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E8=BF=9D=E8=83=8C?= =?UTF-8?q?=E6=96=87=E5=AD=97=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文字描述:“另外,你可能还会问为什么 ``__init__()`` 方法中设置了 ``self.first_name`` 而不是 ``self._first_name`` 。” 参考: https://github.com/yidao620c/python3-cookbook/blob/master/cookbook/c08/p06_managed_attribute.py#L12 --- source/c08/p06_create_managed_attributes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/c08/p06_create_managed_attributes.rst b/source/c08/p06_create_managed_attributes.rst index 100be65..cde3819 100644 --- a/source/c08/p06_create_managed_attributes.rst +++ b/source/c08/p06_create_managed_attributes.rst @@ -17,7 +17,7 @@ class Person: def __init__(self, first_name): - self._first_name = first_name + self.first_name = first_name # Getter function @property