Python Object-Oriented Python Dice Roller Giving a Hand

Adebayo Samuel Ojo
Adebayo Samuel Ojo
PHP Development Techdegree Student 8,539 Points

Where is class "list"?

Kenneth created a new file call Inside this file, there is class Hand(list). My question is, where is the class "list" which Hand is extending? I don't think any class was created with the name list. So why was he extending a class that was never declared anywhere?

1 Answer

Jeff Muday
Jeff Muday
Treehouse Moderator 24,707 Points

The "list" class that Kenneth is subclassing is the native Python standard list class.

You are already familiar with square bracked notation for instantiating an empty list.

x = []

and this is equivalent to instatiating with the Python standard list class.

x = list()

The actual source code is implemented in 'C' language and is compiled to native binary for your particular platform. In case you are curious about this code. I linked the repository below.