Re: [Tutor] About using list in a function
On 10/09/2015 23:46, D Wyatt wrote: Scrambled on gmail here too. Please provide some context when you reply, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
Scrambled on gmail here too. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On 19/08/2015 18:25, Alan Gauld wrote: 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.) Scrambled using Thunderbird 38.2.0 on Windows 10. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] About using list in a function
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 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
Hi Michaelle, and welcome. On Wed, Aug 19, 2015 at 12:09:15PM -0400, 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) That line above is your problem. The append() method should be thought of as a procedure that acts in place, not a function which returns a value. So the line: ls = ls.append(100) sets ls to None, a special value that means no result. Instead, you should write this: def getResult(): ls = [] ls.append(100) ls.append(200) return ls Or you can make that even shorter: def getResult(): ls = [100, 200] return ls -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
In a message of Wed, 19 Aug 2015 18:25:56 +0100, Alan Gauld writes: 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.) I got scrambled, same as you. Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
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.) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
Scrambled in the archives, too https://mail.python.org/pipermail/tutor/2015-August/106528.html And looks like something thought it would be best as only one line of text. Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On Wed, Aug 19, 2015 at 10:25 AM, Alan Gauld alan.ga...@btinternet.com wrote: 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. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On Thu, Aug 20, 2015 at 03:05:53AM +1000, Steven D'Aprano wrote: Hi Michaelle, and welcome. Oops, sorry for the typo, I meant Michelle. -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On 8/19/2015 11:20 AM, Marc Tompkins wrote: (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. We're stuck on 29 due to some ECMAScript compatibility issues with existing internal servers. We keep users from upgrading by configuring all user workstations to update only from an internal server where we have only approved compatible sources/packages. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On Wed, Aug 19, 2015 at 11:36 AM, Emile van Sebille em...@fenx.com wrote: On 8/19/2015 11:20 AM, Marc Tompkins wrote: (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. We're stuck on 29 due to some ECMAScript compatibility issues with existing internal servers. Interesting. There are eight million stories in the naked city; I wonder how many stories there are behind old software versions? =D We keep users from upgrading by configuring all user workstations to update only from an internal server where we have only approved compatible sources/packages. I only dream of having that sort of control. Ah well. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
On 19/08/15 18:25, Alan Gauld wrote: 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 As you can (hopefully!) see above, this message is completely scrambled. OK, Looks like I wasn't alone. Steven, if you are still reading this can you confirm whether you got a formatted version or manually unscrambled it? Or can anyone explain why an apparently plain-text message got mangled? -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] About using list in a function
In a message of Thu, 20 Aug 2015 00:37:17 +0100, Alan Gauld writes: On 19/08/15 18:25, Alan Gauld wrote: 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 As you can (hopefully!) see above, this message is completely scrambled. OK, Looks like I wasn't alone. Steven, if you are still reading this can you confirm whether you got a formatted version or manually unscrambled it? Or can anyone explain why an apparently plain-text message got mangled? Her mailer appears to have sent out a plain text message where the whole message was one line with no newlines/returns. So if her mailer is set up to automatically remove them ... Forums do this often but this is the first time I can recall seeing this in email. Laura ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor