[ZODB-Dev] B-Tree API

Guido van Rossum guido@python.org
Tue, 03 Dec 2002 04:54:58 -0500


> > 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'.

Exactly.  It would be poor design to have a sort() method on a
sequence that worked differently than list.sort().

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

Scheme does too, I believe.  I'm afraid it's a little late to add this
to Python, except as an optional naming convention.

--Guido van Rossum (sitting right next to Steve :-)