[Tutor] Python OO

Juan C. juan0christian at gmail.com
Sat Mar 28 20:06:30 CET 2015


So, I'm trying to create a little script here using OO to learn it, and I
got some questions:

The script uses the Movie DB API, and I have a Series module.

In this module I have 3 classes, 'Serie', 'Season' and 'Episode'. In
__main__.py I will instantiate a serie like so 'some_random_name =
Serie(123)', where 123 is the ID of the serie in the API.

Serie class: title, year, length (X seasons), serieid and a function
get_season(self, number)

Season class: number, year, length (X episodes) and a function
get_episode(self, number)

Episode class: title, number, date and two functions, get_character(self,
index) and crew_size()

What would be the best approach using OO? Should I use class inheritance
and how? What would be the best way to create the whole Serie instance with
the least API calls possible?

Remember that when I create a new Serie(serie_id) I create the whole thing,
every season, every episode.

Many thanks.

PS: If you guys know a good book/course/tutorial about Python OO feel free
to post it here.


More information about the Tutor mailing list