[Python-Dev] Re: Guido's Magic Code was: inline sort option
Guido van Rossum
guido at python.org
Thu Oct 30 10:43:04 EST 2003
> > a = [3,2,1]
> > print a.sorted()
> > print list.sorted(a)
>
> Actually, yes, it IS compelling indeed. Funny -- I was originally just
> brainstorming / musing out loud, never thought about this as a "real
> thing". But now that it's matured a bit, I do feel sure [...]
If you feel about it that way, I recommend that you let it mature a
bit more.
If you really like this so much, please realize that you can do this
for *any* instance method. The identity
C.foo(C()) == C().foo()
holds for all "regular" methods. (Since 2.2 it also holds for
extension types.) If we were to do this, we'd be back at square two,
which we rejected: list instances having both a sort() and a sorted()
method (square one being no sorted() method at all :-).
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list