我一直在读书,并没有找到一个好的例子/解释 Bruce Tieche(br**********@usmtm.sppn.af.mil)I am new to python,Could someone explain (in English) how and when to use self?I have been reading, and haven''t found a good example/explanationBruce Tieche (br**********@usmtm.sppn.af.mil)推荐答案 Tieche Bruce MSgt USMTM / AFD写道:Tieche Bruce A MSgt USMTM/AFD wrote:我是python的新手, 有人可以解释(用英语)如何以及何时使用self? I am new to python, Could someone explain (in English) how and when to use self? 不要使用自己。使用其他。 - bruno desthuilliers python -c" print''@''。join([''。'' '.join([w [:: - 1] for p in p.split(''。'')])for p in''o****@xiludom.gro'' .split(''@'')])"Don''t use self. Use other.--bruno desthuillierspython -c "print ''@''.join([''.''.join([w[::-1] for w in p.split(''.'')]) forp in ''o****@xiludom.gro''.split(''@'')])"作为一种风格点:''other''标识符只能在中使用 Zen Metaclass编程作为调用 对象的隐式引用或作为对类的所有其他实例的引用列表。 上下文将使它们同时清楚明显哪个用例是 。 03/11/05,bruno at modulix< on *** @ xiludom.gro>写道:As a point of style: the ''other'' identifier should only be used inZen Metaclass programming as an implicit reference to the callingobject or as a list of references to all other instances of the class.Context will make it both clear and obvious which use case isdesired.On 03/11/05, bruno at modulix <on***@xiludom.gro> wrote: Tieche Bruce A MSgt USMTM / AFD写道: Tieche Bruce A MSgt USMTM/AFD wrote:我是python的新手, 有人可以解释(用英语)如何和何时使用自我? I am new to python, Could someone explain (in English) how and when to use self? 不要使用自我。使用其他。 - bruno desthuilliers python -c" print''@''。join([''。''。join([w [:: - 1] for p.split(''。'')])for p in''on *** @ xiludom.gro''。split(''''')])" - http://mail.python.org / mailman / listinfo / python-list - 生活中需要一点点政府和一点运气,但只有 a傻瓜信任其中任何一个。 - PJ O''Rourke--"A little government and a little luck are necessary in life, but onlya fool trusts either of them." -- P. J. O''Rourke 2005年11月3日星期四10:48:28 -0500, Chris Cioffi< ev * *******@gmail.com>写道:On Thu, 3 Nov 2005 10:48:28 -0500,Chris Cioffi <ev********@gmail.com> wrote:作为一种风格点:''其他''标识符只能在 Zen Metaclass编程中用作对调用的隐式引用对象或作为对该类的所有其他实例的引用列表。上下文将使所有用例都清晰明确。 As a point of style: the ''other'' identifier should only be used in Zen Metaclass programming as an implicit reference to the calling object or as a list of references to all other instances of the class. Context will make it both clear and obvious which use case is desired. 可以我使用''其他''标识符,例如__add__方法? 请? ;-) 问候, Dan - Dan Sommers < http://www.tombstonezero.net/dan/>Can I use the ''other'' identifier in, e.g., an __add__ method?Please? ;-)Regards,Dan--Dan Sommers<http://www.tombstonezero.net/dan/> 这篇关于你何时以及如何使用Self?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-03 12:02