Paul Rubin <http://[EMAIL PROTECTED]> writes:
> print sum([da.get(-(p[0]+q[1]), 0) for p in quads for q in quads])

The above should say:

  print sum(da.get(-(p[0]+q[1]), 0) for p in quads for q in quads)

I had to use a listcomp instead of a genexp for testing, since I'm
still using python 2.3, and I forgot to patch that before pasting to
the newsgroup.  But the listcomp will burn a lot of memory when the
list is large.

I'd be interested in the running time of the above for your large data set.  
Note that it still uses potentially O(n**2) space.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to