Re: Difference between list() and [] with dictionaries

2009-05-16 Thread Aahz
In article mailman.247.1242441988.8015.python-l...@python.org, Ned Deily n...@acm.org wrote: In article fe3354e50905151817ie4df792hebec03ae42eca...@mail.gmail.com, Sam Tregar s...@tregar.com wrote: Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo':

Re: Difference between list() and [] with dictionaries

2009-05-16 Thread Ned Deily
In article gun8m0$qt...@panix3.panix.com, a...@pythoncraft.com (Aahz) wrote: In article mailman.247.1242441988.8015.python-l...@python.org, Ned Deily n...@acm.org wrote: The second example is a call to the built-in function list, [...] Actually, list() is not a function: list type

Difference between list() and [] with dictionaries

2009-05-15 Thread Sam Tregar
Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ a: b, foo: bar }) I expected them to be equivalent but clearly they're not! I'm using Python 2.6.1 if that helps. -sam --

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Ned Deily
In article fe3354e50905151817ie4df792hebec03ae42eca...@mail.gmail.com, Sam Tregar s...@tregar.com wrote: Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ a: b, foo: bar }) The first

Re: Difference between list() and [] with dictionaries

2009-05-15 Thread Gabriel Genellina
En Fri, 15 May 2009 22:17:43 -0300, Sam Tregar s...@tregar.com escribió: Hello all. Can anyone explain why this creates a list containing a dictionary: [{'a': 'b', 'foo': 'bar'}] But this creates a list of keys of the dictionary: list({ a: b, foo: bar }) I expected them to be