且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

你何时以及如何使用Self?

更新时间:2023-10-21 23:18:04

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 desthuilliers
python -c "print ''@''.join([''.''.join([w[::-1] for w in p.split(''.'')]) for
p 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 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.

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 only
a 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/>