Help understanding the decisions *behind* python?

Chris Rebert clp2 at rebertia.com
Mon Jul 20 17:30:16 EDT 2009


On Mon, Jul 20, 2009 at 2:23 PM, Piet van Oostrum<piet at cs.uu.nl> wrote:
>>>>>> Duncan Booth <duncan.booth at invalid.invalid> (DB) wrote:
>
>>DB> Phillip B Oldham <phillip.oldham at gmail.com> wrote:
>>>> This make a lot more sense to us, and follows the convention from
>>>> other languages. It would also mean chaining methods to manipulate
>>>> lists would be easier:
>>>>
>>>>>>> x = [2,1,3]
>>>>>>> print x.sort()[0]
>>>> 3
>>>>>>> print x
>>>> [2,1,3]
>
>>DB> You already have a way to do what you want:
>
>>>>>> x = [2,1,3]
>>>>>> print sorted(x)[0]
>>DB> 3
>
> What kind of Python produces that?

Assuming you're referring to the latter example, it was added in version 2.4
If you meant the former example, I think that's purely pseudo-Python.

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list