Special Method Protocols

__floor__() — numeric protocol

Return the greatest integer not greater than the value.

Formal Syntax & Structure

python syntaxpython
def __floor__(self):

Return Value

Integral

Rounded or integral result specified by the hook.

Working Example

Example Snippetpython
import mathclass Number:    def __init__(self, value):        self.value = value    def __floor__(self):        return math.floor(self.value)print(math.floor(Number(-3.75)))
Python Reference