On 11/9/2010 1:43 PM, Terry Reedy wrote:
... List *is* useful as an initializer for
collecitons.defaultdicts.
And it was useful when several members of this forum helped me to
develop a prime-number generator.
See http://www.mail-archive.com/python-list@python.org/msg288128.html.
(I meant t
On 11/9/2010 12:19 PM, Ciccio wrote:
Il 09/11/2010 16:47, Terry Reedy ha scritto:
On 11/9/2010 9:14 AM, Ciccio wrote:
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
If you rewr
Thank you all, this was timely and helpful.
francesco
--
http://mail.python.org/mailman/listinfo/python-list
Il 09/11/2010 16:47, Terry Reedy ha scritto:
On 11/9/2010 9:14 AM, Ciccio wrote:
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
If you rewrite this as
bl = []
rg = dict.fromkey
On 11/9/2010 9:14 AM, Ciccio wrote:
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
If you rewrite this as
bl = []
rg = dict.fromkeys(g.keys(),bl)
is the answer any more obvious
Ciccio wrote:
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
In [215]: rg
Out[215]: {'a': [], 'b': []}
In [216]: rg['a'].append('x')
In [217]: rg
Out[217]: {'a': ['x'], 'b': ['x']}
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
In [215]: rg
Out[215]: {'a': [], 'b': []}
In [216]: rg['a'].append('x')
In [217]: rg
Out[217]: {'a': ['x'], 'b': ['x']}
What I meant
On Tue, Nov 9, 2010 at 3:14 PM, Ciccio wrote:
> Hi all,
>
> hope you can help me understanding why the following happens:
>
> In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
> In [214]: rg = dict.fromkeys(g.keys(),[])
The argument you pass which is used to fill the values of the new
dict, is cr
On 2:59 PM, Ciccio wrote:
Hi all,
hope you can help me understanding why the following happens:
In [213]: g = {'a': ['a1','a2'], 'b':['b1','b2']}
In [214]: rg = dict.fromkeys(g.keys(),[])
In [215]: rg
Out[215]: {'a': [], 'b': []}
In [216]: rg['a'].append('x')
In [217]: rg
Out[217]: {'a': ['x'