0

I have the following code:

for file_name, content in corpus.items():
    print('here')
    content = [list(filter(lambda index: index not in remove_indices, content))]
    corpus[file_name] = np.array(content).astype(np.uint32)

Where corpus is a 800,000 long dictionary with string keys and array values.

Things were taking forever so I decided to check how fast each iteration was by adding in that print statement.

If I comment the last two lines out it prints lots of heres really fast, so there's no problem with my iterator. What's really weird is that when I uncomment the last two lines, here takes a long time to print, even for the first one! It's like the print statement is somehow aware of the lines that follow it.

I guess my question speaks for itself. I'm in Jupyter notebook, if that helps.

Alexander Soare
  • 2,825
  • 3
  • 25
  • 53

0 Answers0