[TIP] Mocking properties on an instance

Michael Foord michael at voidspace.org.uk
Mon Sep 12 05:34:37 PDT 2011


On 12/09/2011 13:27, Chris Wesseling wrote:
> On 2011-09-12T10:52:14+0100, Michael Foord wrote:
>> On 05/09/2011 09:11, Chris Wesseling wrote:
>>> On 2011-09-04T23:29:09+0100, Michael Foord wrote:
>>>>> (P.S. I really do wish python had a sortedset and frozendict type already but that is a different discussion :/ )
>>>> Indeed. :-)
>>>>
>>>> (There was a proposal to make sets sorted by default. I'm not sure
>>>> what has happened to that though.)
>>> By default? Blegh. :-r
>>>
>> Why? What would the downside be?
> By definition they don't have order.

By *current definition* they are unordered. The proposal is to add ordering.
> So would it change the semantics of equality?
>
> set(range(5)) != set(range(4, -1, -1))
>
No it wouldn't, that would be backwards incompatible. You could check 
order equivalence with:

     list(set1) == list(set2)

Note that I don't know what happened to the proposal or if it still 
stands any chance of inclusion. If it is implemented it will be done in 
a backwards compatible way.

Michael

-- 
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html




More information about the testing-in-python mailing list