3 ms·
The code in this post seem a bit unpythonic and "improvable" for me: - "if len(list) > n" should probably be "if n in list". - The function has a side effect
by gbog 15y ago
The code in this post seem a bit unpythonic and "improvable" for me:
- "if len(list) > n" should probably be "if n in list".
- The function has a side effect (changing the list), this is to be avoided when avoidable
- Memoization is not part of the logic, thus is better done with a decorator (which would solve above side effect issue)