I am working on the problem posed by this post: Fast way to remove a few items from a list/queue
Basically all I want to do is implement a for loop in C. The for loop needs to access a generator and be able to delete elements of an array (and increment an integer). Something in me tells me this would be painfully difficult, but another part says it could be handled in minutes.
I have no experience writing high level C (I've written code for microcontrollers though), and the tutorials for ctypes and other c-> python seem like they are addressing more difficult problems.
def forfilt():
marked = (i for i, x in enumerate(b) if tokeep(x))
shift = 0
for n in marked:
del b[n - shift]
shift += 1
I'm asking two questions:
IS this difficult?
Do you have any pointers/want to write the code yourself? :D
This seems like a rather important problem to me actually. I don't know of any way to quickly do what the original question was asking. I suppose if you know the answer to that, then the question is void.