How to call Inner Class?

77 views Asked by At

Is there any difference between call Person.Name() and self.Name() despite Person.Name() being more readable?

class Person:
    class Name:
        def __init__(self, first_name, last_name):
            self.first_name = first_name
            self.last_name = last_name

        def __str__(self):
            return f'{self.first_name}, {self.last_name}'

    def __init__(self, first_name, last_name):
        self.name = Person.Name(first_name, last_name)
0

There are 0 answers