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.


Andras Andras
Andras Andras
7,941 Points

New instance of a class means inheritance?

Hello, I am a bit confused. Does the new instance of a class in python means inheritance like in c#

1 Answer

26,615 Points

Not sure about C#, but in python, new instance is not the same as inheritance.

An inheritance is when a new class you create uses the methods from another existing class.

Basically a new instance is a variable of that class.

For example:

word  = str("foo")

The variable word is an instance of the string object, and it has all of the methods that the string object has.

You can create other instances of str() by assigning str() to other variables:

thing = str("goodies")
food = str("pizza")
movie = str("Lord of the Rings")

thing, food, and movie are all instances of str().

Not sure if this made any sense... I'm bad at explaining things.

Andras Andras
Andras Andras
7,941 Points

Thanks hamsternation, It makes sense now, there are a lot of expression starting with letter "i".