On 07/23/2010 10:34 AM, Navin Kabra wrote:
On Thu, Jul 22, 2010 at 7:31 PM, Shashwat Anand
<anand.shash...@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/
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to