[ZODB-Dev] B-Tree API

Steve Alexander steve@cat-box.net
Tue, 03 Dec 2002 10:32:31 +0000


Guido van Rossum wrote:
>     if isinstance(seq, list):
>         seq.sort()
> 
> 
> Make that
> 
>       if hasattr(seq, 'sort'):
>           seq.sort()

That's nice, until I write a class that doesn't sort in-place and 
instead returns a sorted copy of the original.

Then again, if I did that, I guess I should use a different name than 
'sort'.

I believe the language Ruby has the notion of distinguishing operations 
that mutate an object, and those that do not.

--
Steve Alexander