docs patch:dicts和sets

问题描述:

这次讨论突然结束了,我希望看到它达到了一个结果。我将尝试综合Bill和Carsten的

提案。


有两个建议的补丁。第一个是
http://docs.python.org/ lib / typesmapping.html

建议在脚注(3)中说明:


键和值以任意顺序列出。这个订单是

不确定,通常取决于包含程序范围之外的因素

。但是,如果调用items(),keys(),values(),

iteritems(),iterkeys()和itervalues()而没有

干预修改字典,列表将

直接对应。


第二个是 http://docs.python.org/lib/types-set.html

其中提案是在第2段添加一个新句子:


对一个集合的迭代返回一个不确定的

顺序中的元素,这通常取决于超出范围的因素

包含程序。


Alan Isaac

This discussion ended abruptly, and I''d like to see it reach a
conclusion. I will attempt to synthesize Bill and Carsten''s
proposals.

There are two proposed patches. The first is to
http://docs.python.org/lib/typesmapping.html
where it is proposed for footnote (3) to state:

Keys and values are listed in an arbitrary order. This order is
indeterminate and generally depends on factors outside the scope
of the containing program. However, if items(), keys(), values(),
iteritems(), iterkeys(), and itervalues() are called with no
intervening modifications to the dictionary, the lists will
directly correspond.

The second is for http://docs.python.org/lib/types-set.html
where the proposal is to append a new sentence to the 2nd paragraph:

Iteration over a set returns elements in an indeterminate
order,which generally depends on factors outside the scope of the
containing program.

Alan Isaac

我提交了基于比尔和卡斯滕提议的语言:

https://sourceforge.net/tracker/?fun...&group_id= 5470


该语言被拒绝。

你们很多人都想阅读讨论,看看

是否可以接受语言似乎仍然可以被发现。


Alan Isaac
I submitted the language based on Bill and Carsten''s proposals:

https://sourceforge.net/tracker/?fun...&group_id=5470

That language has been rejected.
You many want to read the discussion and see if
acceptible language still seems discoverable.

Alan Isaac


Alan Isaac写道:
Alan Isaac wrote:

我根据Bill和Carsten的提议提交了这种语言:

https://sourceforge.net/tracker/?fun...&group_id=5470
>
该语言被拒绝。

你们很多人都想阅读讨论,看看

可接受的语言是否仍然可以被发现。
I submitted the language based on Bill and Carsten''s proposals:

https://sourceforge.net/tracker/?fun...&group_id=5470

That language has been rejected.
You many want to read the discussion and see if
acceptible language still seems discoverable.



在我看来,你正专注于文档的错误部分。这个bug的

来源不是set或dicts,而是默认的__hash__

方法实现。为什么不建议添加类似的东西:


默认的__hash__方法基于对象的id(),因此可以

在同一个程序的不同迭代之间进行更改。


到__hash__的文档:

http://docs.python.org/ref/customization.html


然后如果你真的觉得你需要为套装和dicts添加一些东西,

你可以添加对__hash__文档的交叉引用。


STeVe

Seems to me that you''re focusing on the wrong part of the docs. The
source of this "bug" is not sets or dicts, but the default __hash__
method implementation. Why don''t you propose adding something like:

The default __hash__ method is based on an object''s id(), and can
therefore change between different iterations of the same program.

to the docs for __hash__:

http://docs.python.org/ref/customization.html

Then if you really feel you need to add something for sets and dicts,
you can add a cross-reference to the __hash__ docs.

STeVe


5月19日上午9:06,Steven Bethard< steven.beth ... @ gmail.comwrote:
On May 19, 9:06 am, Steven Bethard <steven.beth...@gmail.comwrote:

Alan Isaac写道:
Alan Isaac wrote:

我根据Bill和Carsten的提议提交了语言:
I submitted the language based on Bill and Carsten''s proposals:

https://sourceforge.net/tracker/?fun...0&aid=1721372& ...
https://sourceforge.net/tracker/?fun...0&aid=1721372&...


该语言被拒绝了。

你们很多人都想阅读讨论,看看

可接受的语言是否仍然可以被发现。
That language has been rejected.
You many want to read the discussion and see if
acceptible language still seems discoverable.



在我看来,你专注于文档的错误部分。这个bug的

来源不是set或dicts,而是默认的__hash__

方法实现。为什么不建议添加类似的东西:


默认的__hash__方法基于对象的id(),因此可以

在同一个程序的不同迭代之间进行更改。


到__hash__的文档:

http://docs.python.org/ref/customization.html


然后如果你真的觉得你需要为套装和dicts添加一些东西,

你可以添加对__hash__文档的交叉引用。


STeVe


Seems to me that you''re focusing on the wrong part of the docs. The
source of this "bug" is not sets or dicts, but the default __hash__
method implementation. Why don''t you propose adding something like:

The default __hash__ method is based on an object''s id(), and can
therefore change between different iterations of the same program.

to the docs for __hash__:

http://docs.python.org/ref/customization.html

Then if you really feel you need to add something for sets and dicts,
you can add a cross-reference to the __hash__ docs.

STeVe



这是一个想法 - 将所有建议的更改添加到文档中。为什么不

允许用户为他们想要的文档添加任何解释?然后

读者可以选择对他们最有意义的解释。

这将消除关于细节是什么的无休止的小讨论

more这很重要,它可以让人们花更多的时间在更多的生产上。它会以指数方式改进文档。


Here''s an idea--add All the proposed changes to the docs. Why not
allow user''s to add any explanations to the docs that they want? Then
readers can choose the explanations that make the most sense to them.
It would eliminate endless, petty discussions about what minutiae are
more important, and it would allow people to spend their time on more
productive efforts. And it would improve the docs exponentially.