Question from the Python test

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

Waiting for validation

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: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!