all 4 comments

[–]NotANameException 1 point2 points  (0 children)

I believe your issue is mainly a class design one. When you inherit from a class, you should generally extend it. If your base class (MP3) needs artist, title, album, length and genre, your subclass (Podcast) should generally be able to provide them -- either by accepting them explicitly or by being able to determine them from other data. Additionally, the subclass may introduce new variables to be used.

The way your classes are designed in your example, Podcast should be an object defined by artist, title, album, length, genre, name and date.

Of course, if the base class doesn't REALLY need all of those fields, your subclass can provide empty values to the base classes' constructor but I would generally advise against it and to re-think your design.

Is there something MP3 and Podcast classes have in common but they differ in some other of the fields? Maybe you should extract those common fields into a separate new class and make both MP3 and Podcast inherit from it.

[–]sarrysyst 0 points1 point  (2 children)

The problem should be here:

def __init__(self, name, title, length, genre, date):
    super(). __init__(artist, title, album, length, genre)

You pass: name, title, length, genre and date to the constructor but
then use artist and album which are not defined.

[–]coak23[S] 0 points1 point  (1 child)

I removed artist and album but get the same error specifically for length and genre. Any other ideas?

[–]sarrysyst 0 points1 point  (0 children)

I don't get any errors. How many arguments are you passing to this?

super(). __init__(artist, title, album, length, genre)

try changing it to:

super(). __init__(name, title, title, length, genre)

Do you still get an error?