[ZODB-Dev] B-Tree API

THoffman@indtech.wa.gov.au THoffman@indtech.wa.gov.au
Tue, 3 Dec 2002 18:05:03 +0800


On Tue, 2002-12-03 at 17:54, Guido van Rossum wrote:
> > > 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.

Maybe that could be an inspectable property of a function/method in
newer versions of python, at least then something like idle with it's
arg hints could also tell you if the method modifies or returns a copy
of the object

T


> 
> --Guido van Rossum (sitting right next to Steve :-)
> 
> _______________________________________________
> For more information about ZODB, see the ZODB Wiki:
> http://www.zope.org/Wikis/ZODB/
> 
> ZODB-Dev mailing list  -  ZODB-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zodb-dev



DISCLAIMER: This email, including any attachments, is intended only for use
by the addressee(s) and may contain confidential and/or personal information
and may also be the subject of legal privilege. Any personal information
contained in this email is not to be used or disclosed for any purpose other
than the purpose for which you have received it. If you are not the intended
recipient, you must not disclose or use the information contained in it. In
this case, please let me know by return email, delete the message
permanently from your system and destroy any copies. Emails and their
attachments may be interfered with, may contain computer viruses or other
defects and may not be successfully replicated on other systems. All
attachments are opened at the recipient's risk.