Special Method Protocols

__ceil__() — numeric protocol

Return the least integer not less than the value.

Formal Syntax & Structure

python syntaxpython
def __ceil__(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 __ceil__(self):        return math.ceil(self.value)print(math.ceil(Number(-3.75)))
Python Reference