Den 11/06/2014 kl. 14.49 skrev hito koto <hitokoto2...@gmail.com>:

> 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

Your function doesn't modify "x", so "x != []" is always true. You created an 
endless loop which appends "y" until memory is exhausted. Hence the MemoryError.

These aren't Django-specific questions anymore, so you should head over to a 
Python mailing list to get further help with basic Python programming.

Erik

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CC989AD0-05AB-4DF5-972E-8B0347009F8B%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to