[Tutor] ***SPAM*** List to dictionary

Python python at venix.com
Thu Dec 7 18:53:47 CET 2006


On Thu, 2006-12-07 at 08:22 -0700, Mike Hansen wrote:
>  
> > -----Original Message-----
> > From: tutor-bounces at python.org 
> > [mailto:tutor-bounces at python.org] On Behalf Of Luke Paireepinart
> > Sent: Wednesday, December 06, 2006 10:54 PM
> > To: tutor at python.org
> > Subject: Re: [Tutor] ***SPAM*** List to dictionary
> > 
> > Also, why is there now a ******SPAM***** in the subject heading?
> > 
> > Wonderingly,
> > -Luke
> > 
> 
> Maybe Bill was labeling it SPAM since it was posted twice to the list?
> <shrug />
> Wed Dec 6 17:00:18 CET 2006
> Thu Dec 7 04:31:55 CET 2006
> 
> Also, I tried to explain in my reply yesterday. "The next statement
> (temp[i] = 0) is where I get confused.

temp is a dictionary.  ## earlier code was temp = {}
i is a name from a list called names.
temp[i] is a reference into the dictionary using i as a key.
temp[i] = 0 binds that reference to 0.  Any previous value for temp[i]
is discarded.

temp is simply being used to track distinct names.  Any name from names
will have one and only one occurrence in the list of dictionary keys.

So temp.keys() will contain each name exactly once.  As covered in a
recent thread, the ordering of the names will probably be different from
the original names list.


> Can someone please explain what is happening here. "
> 
> I'm confused. %)
> -------------
> 
>   NOTICE:  This e-mail transmission and any documents or files attached to
>   it contain information for the sole use of the above-identified individual or entity.
> 
>   Its contents may be privileged, confidential, and exempt from disclosure under the law.
>   Any dissemination, distribution, or copying of this communication is strictly prohibited.
> 
>   Please notify the sender immediately if you are not the intended recipient.
> 
> FGNS
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list