object .__ ceil __ (self)
self - A reference to the instance.
If this method is defined in a custom class, then it will be called when referring to math .ceil () .
from math import ceil
class MyClass:
def __init__ (self, val):
self.val = val
def __ceil __ (self):
return self.val + 1
my_var = MyClass (6)
ceil (my_var) # 7