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': 'bar'}] >> But this creates a list of keys of the dictionary: >> list({ "a": "b", "foo": "bar" }) > >The first example is a list, expressed as a list display literal, >containing one object: a dictionary, expressed as a dictionary display >literal. > >The second example is a call to the built-in function "list", [...]
Actually, list() is not a function: >>> list <type 'list'> Rather, ``list`` is an object (specifically a ``type`` object) with a __call__() method. -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "In 1968 it took the computing power of 2 C-64's to fly a rocket to the moon. Now, in 1998 it takes the Power of a Pentium 200 to run Microsoft Windows 98. Something must have gone wrong." --/bin/fortune -- http://mail.python.org/mailman/listinfo/python-list