__name__成为读写? [英] __name__ becoming read-write?

查看:75
本文介绍了__name__成为读写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是否因为__name__成为读写而产生幻觉?


不在alpha2中。


找不到对此的引用我以为我读过 - 这是

结论与PEP318有关。


最好先直接了解我的事实....


但如果是真的那么似乎可以解决主要的反对意见:


the_horrible_name_I _need_to_call =变换(__ f)


并且意味着PEP318实现的副产品将会消耗50%的b $ b,以避免需要PEP318实现。至少

一个尺寸。


但整件事可能是幻觉。


Art



Did I hallucinate something about __name__ becoming read-write?

Not in alpha2.

Can''t find the reference to this I thought I read - that it was
concluded to be necessary in connection with PEP318.

Better get my facts straight first....

But if true that would seem to solve the main objection to:

the_horrible_name_I _need_to_call=transform(__f)

And would mean that a byproduct of the PEP318 implementation would go
50% toward obviating the need for a PEP318 implementation. At least
by one measure.

But the whole thing might be a hallucination.

Art

推荐答案

Arthur写道:
Arthur wrote:
我是否因为__name__成为读写而产生幻觉?
Did I hallucinate something about __name__ becoming read-write?




_Becoming_读写?什么时候只读?


Python 1.5.2(#1,2004年7月14日,20:34:28)[GCC 3.2.3]关于sunos5

版权所有1991-1995阿姆斯特丹Stichting Mathematisch Centrum



_Becoming_ read-write? When was it read-only?

Python 1.5.2 (#1, Jul 14 2004, 20:34:28) [GCC 3.2.3] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

class foo:传递
.... foo。 __name__ =''bar''
foo .__ module__ =''baz''
foo
class foo: pass .... foo.__name__ = ''bar''
foo.__module__ = ''baz''
foo



< class baz。酒吧在c5ee0>


-

Hallvard


<class baz.bar at c5ee0>

--
Hallvard


Arthur< aj **** **@optonline.com>写道:
Arthur <aj******@optonline.com> writes:
我是否因为__name__成为读写而产生幻觉?


功能?不,你没有产生幻觉。

不在alpha2中。


的确如此。这些更改仅在几周前检查过。

他们将在alpha3中。

找不到对此的引用我以为我读过 - 认为它与PEP318有关是必要的。


这是我多年来一直在唠叨的事情,但这是一篇与PEP相关的评论,最终刺激了我编写补丁。

最好先直接了解我的事实......
Did I hallucinate something about __name__ becoming read-write?
For functions? No, you didn''t hallucinate that.
Not in alpha2.
Indeed. The changes were only checked in a couple of weeks ago.
They''ll be in alpha3.
Can''t find the reference to this I thought I read - that it was
concluded to be necessary in connection with PEP318.
It''s something that''s been nagging at me for ages, but it was a PEP
318-related comment that finally prodded me into writing the patch.
Better get my facts straight first....




很高兴为您提供服务< wink>!


干杯,

mwh

-

我已经彻底改变了这个想法我在每个项目中都使用

编程语言中的变量和类型。

- Greg Ward,1998年9月



Glad to be of service <wink>!

Cheers,
mwh

--
I''ve reinvented the idea of variables and types as in a
programming language, something I do on every project.
-- Greg Ward, September 1998


2004年8月23日16:50:22 +0200,Hallvard B Furuseth

< h。********** @ usit.uio.no>写道:
On 23 Aug 2004 16:50:22 +0200, Hallvard B Furuseth
<h.**********@usit.uio.no> wrote:
Arthur写道:
Arthur wrote:
我是否因为__name__成为读写而产生幻觉?
Did I hallucinate something about __name__ becoming read-write?



_ Becoming_读写?它什么时候是只读的?

Python 1.5.2(#1,2004年7月14日,20:34:28)[GCC 3.2.3]关于sunos5
版权所有1991-1995 Stichting阿姆斯特丹的Mathematisch Centrum



_Becoming_ read-write? When was it read-only?

Python 1.5.2 (#1, Jul 14 2004, 20:34:28) [GCC 3.2.3] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam

class foo:pass ... foo .__ name__ =''bar''
foo .__ module__ ='''baz''
foo< class baz.bar at c5ee0>
class foo: pass... foo.__name__ = ''bar''
foo.__module__ = ''baz''
foo<class baz.bar at c5ee0>




Python 2.3.4(#53,2004年5月25日,21:17:02)[MSC v。 1200 32位(英特尔)]
win32上的



Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32

def foo():
pass

foo .__ name __ =''bar ''
def foo(): pass
foo.__name__=''bar''




回溯(最近一次调用最后一次):

文件"< pyshell#3> ;",第1行,在-toplevel-

foo .__ name __ =''bar''

TypeError:readonly属性


我希望我不是傻瓜。


和1.5.2运行有什么关系;)


Art



Traceback (most recent call last):
File "<pyshell#3>", line 1, in -toplevel-
foo.__name__=''bar''
TypeError: readonly attribute

I hope I''m not being stupid.

And what''s with running 1.5.2 ;)

Art


这篇关于__name__成为读写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆