2004年03月23日 星期二 09:54
呵呵,明白了。谢谢各位,如果用了self.xx就能在一个类中任何地方(方法)访问吧? ----- Original Message ----- From: 0.706 To: python-chinese at lists.python.cn Sent: Tuesday, March 23, 2004 9:01 AM Subject: Re: [python-chinese]关于 self poly,您好! 关键在前面的self,这说明了该变量是属于实例的。如果前面没有self,才是局部变量. ======== 2004-03-23 08:56:58 您在来信中写道: ======== 我看见书上的代码,比如在__init__中用 self.aa="" self.bb="" 后,这个aa,bb应该是只属于__init__的局部变量嘛,为什么在其他方法中还可以用self.aa来调用呢,这不是成了全局变量?有点没有搞懂,请指点 = = = = = = = = = = = = = = = = = = = = = = 致 礼! 0.706 0.706 at 163.com 2004-03-23 ------------------------------------------------------------------------------ _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040323/e124a710/attachment.htm
2004年03月23日 星期二 10:10
一般所有用到的实例变量都在__init__中初始化的。 没左先右当然不行。 ----- Original Message ----- From: poly To: python-chinese at lists.python.cn Sent: Tuesday, March 23, 2004 9:54 AM Subject: Re: [python-chinese]关于 self 呵呵,明白了。谢谢各位,如果用了self.xx就能在一个类中任何地方(方法)访问吧? ----- Original Message ----- From: 0.706 To: python-chinese at lists.python.cn Sent: Tuesday, March 23, 2004 9:01 AM Subject: Re: [python-chinese]关于 self poly,您好! 关键在前面的self,这说明了该变量是属于实例的。如果前面没有self,才是局部变量. ======== 2004-03-23 08:56:58 您在来信中写道: ======== 我看见书上的代码,比如在__init__中用 self.aa="" self.bb="" 后,这个aa,bb应该是只属于__init__的局部变量嘛,为什么在其他方法中还可以用self.aa来调用呢,这不是成了全局变量?有点没有搞懂,请指点 = = = = = = = = = = = = = = = = = = = = = = 致 礼! 0.706 0.706 at 163.com 2004-03-23 ---------------------------------------------------------------------------- _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese ------------------------------------------------------------------------------ _______________________________________________ python-chinese list python-chinese at lists.python.cn http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040323/76ade709/attachment.html
Zeuux © 2024
京ICP备05028076号