Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91901

Re: What is the difference between list() and list?

References <3ada3275-68c9-421c-aa19-53c312c42b1f@googlegroups.com>
Date 2015-06-02 17:38 -0400
Subject Re: What is the difference between list() and list?
From Joel Goldstick <joel.goldstick@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.82.1433281108.13271.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Jun 2, 2015 at 5:33 PM, fl <rxjwg98@gmail.com> wrote:
> Hi,
>
> I find the following results are interesting, but I don't know the difference
> between list() and list.
>
>
>
>
>
>
>>>> nums=list()
>>>> nums
> []
>>>> xx=list
>>>> xx
> <type 'list'>
>>>> nums
> []
>>>> print(xx)
> <type 'list'>
>>>> print(nums)
> []
>>>>
>
>
>
> Could you tell me that?

list is the name of a built-in function that returns a list object
when you set xx = list, you are giving that function a new name -- 'xx'
when you invoke the function:  xx() or list() it returns a list
>
> Thanks,
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What is the difference between list() and list? fl <rxjwg98@gmail.com> - 2015-06-02 14:33 -0700
  Re: What is the difference between list() and list? Joel Goldstick <joel.goldstick@gmail.com> - 2015-06-02 17:38 -0400
  Re: What is the difference between list() and list? "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 14:40 -0700
  Re: What is the difference between list() and list? John Gordon <gordon@panix.com> - 2015-06-02 21:49 +0000

csiph-web