Re: adding values to keys

2008-02-15 Thread Steve Holden
Dennis Lee Bieber wrote: > On Thu, 14 Feb 2008 23:55:21 -0800 (PST), Brandon > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Hi all, >> >> I'm not sure if I'm calling the right method in a dictionary. I have: >> >> for k,v in dict.items(): > > Don't call your dictio

Re: adding values to keys

2008-02-15 Thread Bruno Desthuilliers
Dennis Lee Bieber a écrit : > On Thu, 14 Feb 2008 23:55:21 -0800 (PST), Brandon > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: (snip) >> MT.fromkeys(NT[0], range(alpha,omega)) > > Note that NT is a single tuple -- your previous loop throws away the > prior value and binds

Re: adding values to keys

2008-02-15 Thread Bruno Desthuilliers
Brandon a écrit : > Hi all, > > I'm not sure if I'm calling the right method in a dictionary. I have: > > for k,v in dict.items(): don't use 'dict' as an identifier, this shadows the builtin dict type. > NT = k,range(alpha,omega)#where alpha and omega are > previously defined as 1

adding values to keys

2008-02-15 Thread Brandon
Hi all, I'm not sure if I'm calling the right method in a dictionary. I have: for k,v in dict.items(): NT = k,range(alpha,omega)#where alpha and omega are previously defined as 1 and 4, respectively print NT which gives: ('w', [0,1,2,3]) ('x', [0,1,2,3]) ('y', [0,1,2,3]) ('z',