this is an example code from a book:
class Car():
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
    def describe(self):
        long = str(self.year) + ' ' + self.make + ' ' + self.model
        return long.title()
mycar = Car('audi', 'a4', 2016)
print(mycar.describe())
i was thinking if i could make describe() do the same thing, but be more dynamic. and made a change:
class Car():
    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
    def describe(self):
        l = str(''.join(str([getattr(self, a) for a in dir(self) if not a.startswith('__')])))
        print(l)
mycar = Car('audi', 'a4', 2016)
mycar.describe()
I thought the code for describe() made perfect sense but the output is a little unexpected..
above code output:
─$ python3 carclassup.py
[<bound method Car.describe of <__main__.Car object at 0x7f0f5abaa8e0>>, 'audi', '14', 2016]
- Why is the output showing in a list? I tried to - str()but it still outputs in list.
- What is - <bound method Car.describe of <__main__.Car object at 0x7f0f5abaa8e0>>? I would like it not to be output.
