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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Ivan Frances Alcantara](https://secure.gravatar.com/avatar/1adcf20659ff6614fff8a2346753980c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ivan Frances Alcantara
4,528 PointsWhy does sword.description return only sharp? (min 7:25)
If I am not wrong, Kenneth creates an item in Python shell with instance = Item(attribute1, attribute2, attribute3); and then calls description on it, which returns only attribute2. I have not seen .description being used before in Python Basics course, so I'm a little bit lost there.
1 Answer
![KRIS NIKOLAISEN](https://secure.gravatar.com/avatar/65d74a723997b41a80d2d909c6e06960?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
KRIS NIKOLAISEN
54,969 PointsI'm not sure in which video he creates the items.py file but I downloaded the project files to see what they contain. In items.py is an Item class:
class Item:
def __init__(self, name, description):
self.name = name
self.description = description
def __str__(self):
return '{}: {}'.format(self.name, self.description)
class Weapon(Item):
def __init__(self, name, description, power):
super().__init__(name, description)
self.power = power
The Item class has a description attribute and is imported in the video with the line:
from items import Item
He then creates an instance of the class with:
sword = Item('sword', 'sharp')
at which point you can return 'sharp' with sword.description
Ivan Frances Alcantara
4,528 PointsIvan Frances Alcantara
4,528 PointsA thousand thanks!