[TIP] Mocking properties on an instance

Michael Foord michael at voidspace.org.uk
Mon Sep 12 04:10:34 PDT 2011


On 12/09/2011 12:03, Herman Sheremetyev wrote:
> On Mon, Sep 12, 2011 at 7:09 PM, Michael Foord<michael at voidspace.org.uk>  wrote:
>> On 12/09/2011 11:01, Herman Sheremetyev wrote:
>>> On Mon, Sep 12, 2011 at 6:52 PM, Michael Foord<michael at voidspace.org.uk>
>>>   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?
>>> Sorting isn't free and it's easily available if you actually need it.
>>> What would the upside be from always paying an extra nlogn?
>> The sorting is on insertion order (so ordering rather than sorting really),
>> which basically is free as you know the insertion order.
> Sure that's negligible computationally but O(N) storage for keeping
> track of the ordering, so still not even close to free..
Well, sure it's O(N) - but it's one pointer per item and storage is 
*already* O(N) so you'll never notice the difference.

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