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

Alex Martelli aleaxit at yahoo.com
Sat Oct 18 17:12:38 EDT 2003


On Saturday 18 October 2003 10:54 pm, Dan Aloni wrote:
   ...
> Perhaps it could be made more understandable like:
>   >>> sorted = lambda x: x.sort() or x
>   >>> sorted(list(a))

No fair -- that's not a single expression any more!-)

> The only problem is that you assume .sort() always returns a non
> True value. If some time in the future .sort() would return self,
> your code would break and then the rightful usage would be:

Why do you think it would break?  It would do a _tiny_ amount of
avoidable work, but still return the perfectly correct result.  Sure
you don't think I'd post an unreadable inline hack that would break
in the unlikely case the BDFL ever made a change he's specifically
Pronounced again, right?-)


> I didn't see the begining of this discussion, but it looks to me that
> sort() returning self is much better than adding a .copysort().

The BDFL has Pronounced against it: he doesn't LIKE chaining.


Alex




More information about the Python-Dev mailing list