In your function, if x is not a empty list, then while will be a infinite loop, x always not be []; then the inner for-loop will append many many items into y list, Then your computer will say "have the Memory Error", to tell you the memory not enought.
[email protected] From: hito koto Date: 2014-06-11 20:49 To: django-users Subject: Re: Django Python roop MemoryError , Why? idon't know. I try this have Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 5, in foo MemoryError errors: I'm change to this code: have the Memory Error, def foo(x): y = [] while x != []: for i in range(len(x)): y.append(x[i]) return y 2014年6月11日水曜日 20時21分42秒 UTC+9 hito koto: Hello, all I want to change to while statement from for statement, so how can i do to? this is my correct for statement codes: def fff(x): y = [] for i in range(len(x)): y.append(x[i]) return y and i want change to while statement So, this code have erroes: TypeError: list indices must be integers, not list def fff(x): y = [] while x !=[]: for i in x: y.append(x[i]) return y -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cae941c1-3af8-4ba7-9a1c-2d1232dbed9b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2014061121074166965044%40gmail.com. For more options, visit https://groups.google.com/d/optout.

