Search code examples
pythonnumpyscikits

Why combine np.floor function and the // operator in Python?


I am reading the source code of the library 'scikits-image' written in Python, I found the next line of code:

n_cellsx = int(np.floor(sx // cx)) 

I don't know why they join the NumPy function floor and the // operator. Is there any reason to do this? I can't see. I feel that is doing the same thing twice.

The project is here


Solution

  • There is no reason to do that, // will return either an integer or a float corresponding to an integer, so floor will do nothing.