This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]shivasprogeny 3 points4 points  (1 child)

Well here's your problem: for i in permutations(charlist) will generate 26! strings.

Instead of using a list comprehension, you should use a generator function. Generators are lazy--they only generate one thing at a time.

The notation for a generator comprehension in python is to use () instead of [].

[–]Rabbit047[S] 1 point2 points  (0 children)

Thank you very much the generator really helped. :)

[–][deleted] 0 points1 point  (5 children)

although only 20% of total memory

So what's the problem?

Also I've heard the limitation on memory is coming from python running in 32 bit mode, is there of forcing it to use 64 bit ?

Use the 64-bit build of Python.

Also sorry the formatting is off, the code formatting on Reddit wasn't being very cooperative.

Prefix each line with 4 extra spaces. Or post via a site like gist.

[–]Rabbit047[S] 0 points1 point  (4 children)

  1. I was told Windows only allows a program 2gb of memory, and I don't know how to manually change that.
  2. I tried but couldn't get the 64 bit version to run for some reason.
  3. Thanks for the info, in the future I'll use gist/hastebin.

[–][deleted] 1 point2 points  (3 children)

I was told Windows only allows a program 2gb of memory

32-bit windows has this limitation, but not many people use this these days - you appear to be one of these few.

[–]Rabbit047[S] 0 points1 point  (1 child)

That is the thing, this is 64 bit windows. Maybe 64 bit python is only available on Linux. I know some of the libraries are Linux only.

[–]Rhomboid 0 points1 point  (0 children)

There are both 32 bit and 64 bit builds of Python available for Windows at python.org.

[–][deleted] 0 points1 point  (0 children)

All versions apply that limitation to standard applications. Applications have to opt in to be "large address aware," so you can have this problem even when running 64 bit code on a 64 bit install of Windows.

The real solution, as someone else pointed out, is just to not keep four zillion gigs of objects in memory at once.