Bound & Unbound Method Object

35 views Asked by At

Below are the references of two different method objects "display_info" & "get_num". Why is it that "display_info" is unbound object whereas "get_num" is bound object despite both being referred from the same class object "Rectangle"?

class Rectangle:
    num = 0

    def display_info():
        pass

    @classmethod
    def get_num(cls):
        pass

print(Rectangle.display_info)
print(Rectangle.get_num)

OUTPUT:

<function Rectangle.display_info at 0x7f02d97405e0>
<bound method Rectangle.get_num of <class '__main__.Rectangle'>>
0

There are 0 answers