[Tutor] About using list in a function

Marc Tompkins marc.tompkins at gmail.com
Wed Aug 19 20:20:12 CEST 2015

On Wed, Aug 19, 2015 at 10:25 AM, Alan Gauld <alan.gauld at btinternet.com>

> On 19/08/15 17:09, Michelle Meiduo Wu wrote:
>> Hi there,
>> I'm trying to use List in a function. But it doesn't work. Here are
>> sample code not work: ---------------------------------------def
>> getResult():    ls = []    ls= ls.append(100)    ls= ls.append(200)
>> return ls
>> reList = []reList = getResult()lsLength = len(reList)print '\n The length
>> of the list is:' + str(lsLength)-----------------------------------------I
>> ran the above code, there is an error message: AttributeError: 'NoneType'
>> object has no attribute 'append'
>> But the code below not using list in a function
>> works.----------------------------------------------### This works:ls =
>> []ls.append(100)ls.append(200)lsLength = len(ls)print '\n list length is: '
>> + str(lsLength)----------------------------------------------------- Do you
>> know  the reason?
>> Thank you,Michelle
> As you can (hopefully!) see above, this message is completely scrambled.
> Normally that means HTML. But the headers suggest it is plain text.
> Also, I see that Steve replied with a correctly formatted inclusion.
> Did anyone else get the scrambled version?
> And does anyone have any clues why I did?
> (Using Thunderbird v31.8 and normally not having major issues.)
> Same here, using Gmail and usually pretty happy with it.

Completely off-topic: why such an old version of TBird?  I have some
clients (the local office of a large multinational) who need to communicate
with corporate... but corporate IT hasn't dropped SSL 3.0 yet, so they
can't upgrade past version 33. (Every couple of weeks, despite my repeated
attempts to stop TBird from auto-updating, I find that they've got a new
version and can't connect.  Fortunately Mozilla hasn't changed their DB
format, so I can just re-install 33.)  Anyway, I know why _they_ are using
an old, less-secure version, but I'm curious why anybody else would be.

More information about the Tutor mailing list