En Wed, 31 Dec 2008 06:34:48 -0200, Steven D'Aprano
escribió:
Each time you are appending to the list, you append a tuple:
((i, j), sim)
where sim is a float and i and j are ints. How much memory does each of
those take?
sys.getsizeof( ((0, 1), 1.1) )
32
(On Windows, 32 bits, I get 36)
[BON]:
> above sim is floating type.
> s.append is totally coducted 60,494,500 times.
> but this code raise MemoryError.
>
> My computer has 4G RAM.
> i think it's enough. but it doesn't...
Try creating it in a more clean way, here an array of doubles:
>>> from array import array
>>> a = array("d
On Tue, 30 Dec 2008 22:02:49 -0800, [BON] wrote:
> ==
> s=[]
> for i in range(11000-1):
> for j in range(i+1, 11000):
>
> s.append(((i,j),sim))
> ==
> above sim is floating type.
> s.append is totally coducted 60,494,500 times. but t
[BON] ha scritto:
==
s=[]
for i in range(11000-1):
for j in range(i+1, 11000):
s.append(((i,j),sim))
==
above sim is floating type.
s.append is totally coducted 60,494,500 times.
but this code raise MemoryError.
My computer has
On Wed, Dec 31, 2008 at 4:17 PM, James Mills
wrote:
> I have no idea how many bytes of memory
> storing each element of a list consumes
> let alone each float object, but I assure you
> it's not going to be anywhere near that of
> 60494500 4-bytes spaces (do floats in C
> normally consume 4 bytes)
> but this code raise also MemoryError.
>
> How can i resolve this problem?
> please, help...
>
> Regards,
> --
> View this message in context:
> http://www.nabble.com/MemoryError-when-list-append...-plz-help-tp21227745p21227745.html
> Sent from the Python -
in context:
http://www.nabble.com/MemoryError-when-list-append...-plz-help-tp21227745p21227745.html
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http://mail.python.org/mailman/listinfo/python-list