The first method sends everything to any()
whilst the second only sends to any()
when there’s an odd number, so any()
has fewer elements to go through.
More Related Contents:
- Is doing multiplication multiple times or assigning to a variable faster?
- pandas loc vs. iloc vs. at vs. iat?
- Are tuples more efficient than lists in Python?
- What is the best way to generate all possible three letter strings?
- Why is [] faster than list()?
- Why is numpy’s einsum faster than numpy’s built in functions?
- Find out how much memory is being used by an object in Python [duplicate]
- Speed comparison with Project Euler: C vs Python vs Erlang vs Haskell
- What’s a faster operation, re.match/search or str.find?
- Cost of exception handlers in Python
- Which is faster in Python: x**.5 or math.sqrt(x)?
- File read using “open()” vs “with open()” [duplicate]
- It is more efficient to use if-return-return or if-else-return?
- Most efficient way to forward-fill NaN values in numpy array
- [] and {} vs list() and dict(), which is better?
- Performance with global variables vs local
- python: deque vs list performance comparison
- multiprocessing.Pool() slower than just using ordinary functions
- Efficiently Calculating a Euclidean Distance Matrix Using Numpy
- Is & faster than % when checking for odd numbers?
- Get difference between two lists with Unique Entries
- Fastest save and load options for a numpy array
- Count() vs len() on a Django QuerySet
- Try/catch or validation for speed?
- What is the fastest way to output large DataFrame into a CSV file?
- How expensive are Python dictionaries to handle?
- Python Numpy Data Types Performance
- Python FAQ: “How fast are exceptions?”
- Python: is “except KeyError” faster than “if key in dict”?
- how to speed up a vector cross product calculation