Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: What is the difference between list() and list? Date: Tue, 2 Jun 2015 21:49:20 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 39 Message-ID: References: <3ada3275-68c9-421c-aa19-53c312c42b1f@googlegroups.com> NNTP-Posting-Host: panix1.panix.com X-Trace: reader1.panix.com 1433281760 14226 166.84.1.1 (2 Jun 2015 21:49:20 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 2 Jun 2015 21:49:20 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:91906 In <3ada3275-68c9-421c-aa19-53c312c42b1f@googlegroups.com> fl writes: > I find the following results are interesting, but I don't know the difference > between list() and list. 'list()' invokes the list class, which creates and returns a new list. Since you haven't passed any arguments, the list is empty. 'list' refers to the list class itself. Here is a more in-depth example, using functions instead of classes: def hello(name): return 'Hello'. If you call this function, like so: greeting = hello() print greeting You will get the output 'Hello'. But, if you just REFER to the function, instead of actually CALLING it: greeting = hello print greeting You will get this output: Because you omitted the double parentheses, you're getting the hello function object itself, instead of the RESULT of that function. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"