Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-05 Thread Peng Yu
Hi Terry, Thank you for you detailed email. If two collections are equal, should the iteration order be the same? It has always been true that if hash values collide, insertion order matters. However, a good hash function avoids hash collisions as much as possible in practical use cases.

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-05 Thread Chris Angelico
On Sat, May 5, 2012 at 9:04 PM, Peng Yu pengyu...@gmail.com wrote: I agree that people have different opinions on issues like this. But I think that The Customer Is God. Readers of the doc is the customers, the writers of the doc is the producers. The opinion of customers should carry more

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-05 Thread Emile van Sebille
On 5/5/2012 4:04 AM Peng Yu said... I agree that people have different opinions on issues like this. But I think that The Customer Is God. Readers of the doc is the customers, the writers of the doc is the producers. The opinion of customers should carry more weight than producers. Only to a

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-05 Thread Peng Yu
Documentation that takes ten pages to say something is just as bad as documentation that leaves stuff out, because it's almost guaranteed that it won't be read. That's the point. If a simple example (6 lines) can demonstrate the concept, why spending ten pages to explain it. My experience is

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Peng Yu
On Thu, May 3, 2012 at 11:16 PM, Terry Reedy tjre...@udel.edu wrote: On 5/3/2012 8:36 PM, Peng Yu wrote: Hi, list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Chris Angelico
On Fri, May 4, 2012 at 8:14 PM, Peng Yu pengyu...@gmail.com wrote: Thanks. This is what I'm looking for. I think that this should be added to the python document as a manifestation (but nonnormalized) of what A set object is an unordered collection of distinct hashable objects means. There

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Peng Yu
On Fri, May 4, 2012 at 6:21 AM, Chris Angelico ros...@gmail.com wrote: On Fri, May 4, 2012 at 8:14 PM, Peng Yu pengyu...@gmail.com wrote: Thanks. This is what I'm looking for. I think that this should be added to the python document as a manifestation (but nonnormalized) of what A set object

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Terry Reedy
On 5/4/2012 8:00 AM, Peng Yu wrote: On Fri, May 4, 2012 at 6:21 AM, Chris Angelicoros...@gmail.com wrote: On Fri, May 4, 2012 at 8:14 PM, Peng Yupengyu...@gmail.com wrote: Thanks. This is what I'm looking for. I think that this should be added to the python document as a manifestation (but

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Peng Yu
On Fri, May 4, 2012 at 12:43 PM, Terry Reedy tjre...@udel.edu wrote: On 5/4/2012 8:00 AM, Peng Yu wrote: On Fri, May 4, 2012 at 6:21 AM, Chris Angelicoros...@gmail.com  wrote: On Fri, May 4, 2012 at 8:14 PM, Peng Yupengyu...@gmail.com  wrote: Thanks. This is what I'm looking for. I think

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Cameron Simpson
On 04May2012 15:08, Peng Yu pengyu...@gmail.com wrote: | On Fri, May 4, 2012 at 12:43 PM, Terry Reedy tjre...@udel.edu wrote: | On 5/4/2012 8:00 AM, Peng Yu wrote: | On Fri, May 4, 2012 at 6:21 AM, Chris Angelicoros...@gmail.com  wrote: | On Fri, May 4, 2012 at 8:14 PM, Peng

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Peng Yu
On Fri, May 4, 2012 at 6:12 PM, Cameron Simpson c...@zip.com.au wrote: On 04May2012 15:08, Peng Yu pengyu...@gmail.com wrote: | On Fri, May 4, 2012 at 12:43 PM, Terry Reedy tjre...@udel.edu wrote: | On 5/4/2012 8:00 AM, Peng Yu wrote: | On Fri, May 4, 2012 at 6:21 AM, Chris

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Mark Lawrence
On 05/05/2012 00:37, Peng Yu wrote: My point is if something is said in the document, it is better to be substantiated by an example. I don't think that this has anything with learn the spec from behaviour. I side with the comments made by Terry Reedy and Cameron Simpson so please give it a

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-04 Thread Terry Reedy
Peng, I actually am thinking about it. Underlying problem: while unordered means conceptually unordered as far as the collection goes, the items in the collection, if homogenous enough, may have a natural order, which users find hard to ignore. Even if not comparable, an implementation such

When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Peng Yu
Hi, list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? -- Regards, Peng -- http://mail.python.org/mailman/listinfo/python-list

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Dan Stromberg
If you need the same ordering in two lists, you really should sort the lists - though your comparison function need not be that traditional. You might be able to get away with not sorting sometimes, but on CPython upgrades or using different Python interpreters (Pypy, Jython), it's almost certain

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Tim Chase
On 05/03/12 19:36, Peng Yu wrote: list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? Sets are defined as unordered which the documentation[1]

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Andrew Berg
On 5/3/2012 7:36 PM, Peng Yu wrote: When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? Sets are by definition unordered, so depending on their order would not be

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Terry Reedy
On 5/3/2012 8:36 PM, Peng Yu wrote: Hi, list(a_set) When convert two sets with the same elements to two lists, are the lists always going to be the same (i.e., the elements in each list are ordered the same)? Is it documented anywhere? A set object is an unordered collection of distinct