Closed Spratiher9 closed 2 years ago
Does this actually make any difference? I ask because series isn't a bare list but rather a custom object that extends list, which is likely why the explicit len is being used here (to remove any doubt about the intent).
@DanCech yes this one small thing is potentially a big performance anti-pattern The idea is to check whether it is containing any value or is it something that is synonymous with False or None or Blank or empty string or 0. Len() running this computation unnecessarily is not making sense.
What I mean is have you done any performance testing on the change?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In line 245 len() was used as condition. Using the len function to check if a sequence is empty is not idiomatic and can be less performant than checking the truthiness of the object. So removed it