Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

frustration.py passing but do not understand why

I like doing all my coding and testing in ipython. So I came up with this

Creating class

In [87]: class Liar(list):
    ...:     real_length = []
    ...:     def __len__(self, real_length):
    ...:         real_length = super().__len__()
    ...:         return real_length + 3
    ...:

Instantiating

In [88]: x = Liar()

I was looking inside the object (omitting output)

In [89]: dir(x)

showing empty list based on "real_length" variable

In [90]: x.real_length
Out[90]: []

appending item to list

In [91]: x.real_length.append('dog')

showing what is in the list

In [93]: x.real_length
Out[93]: ['dog']

Getting the list length ( I should expect 4 since I add 3 and there is already one item)

In [95]: x.real_length.__len__()
Out[95]: 1

My questions is: Why does this pass the challenge if it fails here? I "passed" the challenge but do not understand why. Thanks in advance!