[Python-ideas] Sort statement

Brandon Mintern bmintern at gmail.com
Sun Jun 15 21:46:52 CEST 2008


On Sat, Jun 14, 2008 at 7:48 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> I don't think that sorting is a frequent enough operation
> in general to justify having its own statement.

Agreed.

>> The main advantage is that it is impossible to make this mistake:
>>
>> x = y.sort()
>
> If you make that mistake, you find out about it very
> quickly, and you learn not to make it again.

Yes, but having .sort() return self would also solve this problem
without anything as radical as introducing a new keyword and syntax.
I'm not saying that this should be done, but I think this would be a
much better alternative than the proposed sort syntax.

Brandon



More information about the Python-ideas mailing list