Difference between list() and [] with dictionaries

Ned Deily nad at acm.org
Sat May 16 23:32:58 CEST 2009


In article <gun8m0$qtl$1 at panix3.panix.com>, aahz at pythoncraft.com (Aahz) 
wrote:
> In article <mailman.247.1242441988.8015.python-list at python.org>,
> Ned Deily  <nad at acm.org> wrote:
> >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.

Yes.  However, it is also true that "list" is listed under the Built-in 
Functions section of the Python Standard Library documentation and, wrt 
to explaining the OP's issue, quacks like a function here.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list