Question from the Python test

What does the "__get__" descriptor do in this Python code?

Medium

What can you say about the __get__ descriptor in the TopClass class below?

class TopClass:
    def __init__(self):
        self.instance = None

    def __get__(self, instance, cls=None):
        self.instance = instance
        return self

    def request_data(self):
        return True


class MainClass:
    top_class = TopClass()
Author: John PendenqueStatus: PublishedQuestion passed 6 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!