A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039709.html below:

copysort patch, was RE: [Python-Dev] inline sort option

copysort patch, was RE: [Python-Dev] inline sort optionAlex Martelli aleaxit at yahoo.com
Tue Oct 28 11:42:39 EST 2003
On Tuesday 28 October 2003 03:01 pm, Phillip J. Eby wrote:
> At 05:29 AM 10/28/03 -0500, Raymond Hettinger wrote:
> >   inlinesort()   # immediately clear how it is different from sort()
> >   sortedcopy()   # clear that it makes a copy and does a sort
> >   newsorted()    # appropriate for a class method constructor
>
> +1 on sortedcopy(), especially if it's usable as a method, e.g.
> myList.sortedcopy().  (Note that that doesn't exclude it also being spelled
> as 'list.sortedcopy(myList)'.)

Please explain how it might work when the argument to list.sortedcopy is *NOT*
an instance of type list, but rather a completely general sequence, as a
classmethod will of course allow us to have.  Maybe I'm missing some
recent Python enhancements, but I thought that, if a method is fully usable
as an instancemethod, then when called on the type it's an unbound method
and will ONLY support being called with an instance of the type as the 1st 
arg.

Hmmm... maybe one COULD make a custom descriptor that does support
both usages... and maybe it IS worth making the .sorted (or whatever name)
entry a case of exactly such a subtle custom descriptor...


Alex


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4