Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Anthony Grodowski4,902 Points
I've never been more confused after watching a single video
Okay this video is full of things that need for me a better explenation than Kenneth has provided in his video. I'd be very grateful to someone who can can accept that challange(:
Why are we using
self = str.__new__(*args, **kwargs)in
class ReversedStr(str)? It looks like it's simillar to usage of
super(), but I don't get from which class we're inheriting that.
What's going on with
class FilledList(list)? Kenneth says something like the purpose of doing that is ignoring whatever comes in with
**kwargs. If that's the point, why can't we just delete them?
Whole explenation of usage of
copy.copy(value)is messed up and Kenneth goes back and forth explaining it... Can someone clarify this for me? I've seen just
copybefore and I don't get why another one is neccessary.
What exactly is the purpose of ?extending(don't know how to call it)? a class with an object like
strlike it happens in for example
super().__getattribute__(item)- from what are we inheriting now by using super?
Please help me with this big confusion!
Henrik ChristensenPython Web Development Techdegree Student 38,319 Points
1) When customizing a mutable object (i.e. a list) you'd use
__init__ and when customizing an immutable object like a string you'd use
super().__init__() calls the constructor of the super class (list) before running the rest of the code in the child class (FilledList)
copy I'd recommend try to read the about shallow copy (copy by reference) and deep copy (copy by value) https://docs.python.org/3/library/copy.html
super() here refers to
class ChildClass(SuperClass): super always refers to the
I'm not sure what exactly it is you're asking in question 4
Guys should really consider re-doing this section. Kinda all over the place with the explanation.