[BangPypers] list problem

steve steve at lonetwin.net
Fri Jul 23 13:00:49 CEST 2010


On 07/23/2010 10:34 AM, Navin Kabra wrote:
> On Thu, Jul 22, 2010 at 7:31 PM, Shashwat Anand
> <anand.shashwat at gmail.com>  wrote:
>>>  Are you sure that'll work ? Is creating a dict from a sequence guaranteed
>>>  to be executed serially withing the sequence ?
>>
>>  It is nowhere mentioned in Docs IIRC but I have never seen any counter
>>  example.
>
> Actually it is guaranteed.
>> From the documentation of "dict":
>
> "The elements of the argument must each also be of one of those kinds,
> and each must in turn contain exactly two objects. The first is used
> as a key in the new dictionary, and the second as the key’s value. If
> a given key is seen more than once, the last value associated with it
> is retained in the new dictionary."

Nice ! Thanks for digging that out Navin ! Anand's solution is really the most 
elegant.

cheers,
- steve

-- 
random spiel: http://lonetwin.net/
what i'm stumbling into: http://lonetwin.stumbleupon.com/


More information about the BangPypers mailing list