Q:

explicit return in __init_

class Rectangle(object):
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self._area = width * height

    @property
    # moved the logic for returning area to a separate method
    def area(self):
        return self._area
0
class Rectangle:
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self.area = width * height
        # return statement removed from here
0

New to Communities?

Join the community