which one do you prefer? python with C# or java?
Paul Rubin
no.email at nospam.invalid
Fri Jun 15 13:32:03 EDT 2012
Alexander Blinne <news at blinne.net> writes:
> An Element of s could be discarded, after every one of the three (k*j
> for k in s)-generators went over it. I don't think that this is possible
> with one deque (at least with the built-in merger of heapq, a
> self-written one could be adapted). Storing everything three times (one
> deque for every generator) would be a mess as well.
I think for 3 lists I'd have just merged manually instead of figuring
out the heapq merge. The deque approach sounds straightforward but
often there is subtlety, so I'll have to try it.
> How do Haskell or Scheme determine when elements are not longer needed?
Normal gc, once there is no reference to an elemeent it is released.
Actually again there may be a subtlety, if there is a symbol pointing
to the stream. I'll check into this but I think when I tested it in
Haskell, it did the right thing.
More information about the Python-list
mailing list