how to solve memory

meInvent bbird jobmattcon at gmail.com
Fri Jun 10 19:31:06 EDT 2016


it is quite ridiculous, 
this time i am sure that i put correct indentation
and add a else statement to make sure recursive call inside the 
if statement , it still memory error, 

where is the memory error?

is itertools.combinations so big for the list?


  if deep == maxx:
   if deep > 0:
    b = []
    for aaa,bbb in itertools.combinations(initlist, 2):     
     b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
    print("deep=")
    print(deep)
    path2 = DFS(b, deep-1, maxx, sourceoperators, path)
    path.append(path2)
   else:
    print ""
  else:
   if deep > 0:
    for aaa,bbb in itertools.combinations(initlist, 2):
     b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
    print("deep=")
    print(deep)
    path2 = DFS(b, deep-1, maxx, sourceoperators, path)
    path.append(path2)
   else:
    print ""
 return path


On Saturday, June 11, 2016 at 12:26:55 AM UTC+8, John Gordon wrote:
> In <8a1c372e-bd6c-4923-8ae1-8f129ec749e4 at googlegroups.com> meInvent bbird <jobmattcon at gmail.com> writes:
> 
> > > I already responded to your earlier post about this program.  Did you
> > > read it?
> 
> > sorry i missed your reply post, 
> > i find post by me and search your name, no this name
> > is your name changed in previous post?
> 
> My comment was that the recursive calls weren't indented in the
> "if deep > 0" block, therefore DFS was being called infinitely with smaller
> and smaller values of deep.  But it appears you have fixed that issue.
> 
> -- 
> John Gordon                   A is for Amy, who fell down the stairs
> gordon at panix.com              B is for Basil, assaulted by bears
>                                 -- Edward Gorey, "The Gashlycrumb Tinies"



More information about the Python-list mailing list