Welcome to Incremental Social! Learn more about this project here!
Check out lemmyverse to find more communities to join from here!

sugar_in_your_tea ,

I did an interview where the candidate said that if it's one line, it runs in constant time. And they were completely serious. And this was in the context of Python list comprehensions.

They claimed this ran in constant time:

new_list = [value for value in my_list]

Whereas this ran in linear time:

new_list = []
for value in my_list:
    new_list.append(value)

We asked clarifying questions, like what happens to the runtime if the list gets really large, and they doubled down.

And this was for a senior Python dev position... No, they didn't get the job.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • technology@lemmy.world
  • incremental_games
  • meta
  • All magazines