Hacker News new | past | comments | ask | show | jobs | submit login

> num % 12

> That enumerate wrapper was unnecessary.

I'm surprised you didn't go all the way and just write

  x = [25, 37, 49]
and tell me the rest of the code was unnecessary!



I mean, was it necessary? Your original Python expression was pretty obfuscated for such a simple calculation.


Are you actually suggesting I didn't realize I could've written x = [25, 37, 49], or what?

Surely the point of the example wasn't "find the optimal way to calculate that particular list of numbers"?


No, I'm suggesting that your original example was a great example of obfuscated Python. Even supposing that you wanted to alter the total number of values generated and the number of initial values to skip, you're doing unnecessary work and made it more convoluted than necessary:

  def some_example(to_skip=2, total_count=3):
    return [n * 12 + 1 for n in range(to_skip, to_skip+total_count)]
There you go. Change the variable names that I spent < 1 second coming up with and that does exactly the same thing without the enumeration or discarding values. In a thread on how computer speed is wasted on unnecessary computation, it seems silly that you're arguing in favor of unnecessary work and obfuscated code.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: