Help understanding the decisions *behind* python?
Duncan Booth
duncan.booth at invalid.invalid
Tue Jul 21 06:28:16 EDT 2009
Hrvoje Niksic <hniksic at xemacs.org> wrote:
> Chris Rebert <clp2 at rebertia.com> writes:
>
>>>>>>>> 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.
>
> sorted([2, 1, 3])[0] evaluates to 1, not 3.
>
I guess you can tell I broke my unbreakable rule to never post untested
code without labelling it as such. :-)
--
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list
mailing list