Newcomer to Python tutorial question

Steven D'Aprano steve at
Fri May 8 20:28:34 EDT 2009

On Thu, 07 May 2009 11:40:57 -0700, Chris Rebert wrote:

>> why is the printed result of
>>>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>>>> print(basket)
>> {'orange', 'banana', 'pear', 'apple'}
>> in the sequence given?
> Because it's *not a sequence* at all, it's a set. 


But the *printed output* is a sequence. It's a sequence of characters. 
The OP doesn't claim that basket is a sequence-type, he is using 
"sequence" in a generic, plain English way.


I agree with the rest of your explanation about arbitrary ordering of 
sets :)


More information about the Python-list mailing list