News for hackers. Stuff that matters.
Re:Interview Gone Wrong by necovek on Sunday November 03, 2024 @11:21PM (#42038405)
I am definitely a subscriber to not doing premature optimization, but in Python, there is a huge difference between

  found = searched_key in list(large_dict)
vs

  found = searched_key in large_dict
But also compare:

  searched_key in large_dict.keys()  # O(1)
and

  searched_value in large_dict.values()  # O(n)
Re:Interview Gone Wrong by carlmr on Monday November 04, 2024 @07:24AM (#42040901)
So much this. Write code that you can reasonably expect to not be slow af, while not sacrificing readability. Then profile and optimize if necessary.