CREATE AN ART MARKETPLACE Veneer

So i got stuck on this project. i got to the point where i call veneer.show_listings(), but instead of printing the listing i created, i get the object location.

<__main__.Listing object at 0x7f6e31cb9d30>

This is my code

class Art:
  def __init__(self, artist, title, medium, year, owner):
    self.artist = artist
    self.title = title
    self.medium = medium
    self.year = year
    self.owner = owner 
  def __repr__(self):
    return "{}. \"{}\". {}, {}, {}, {}".format(self.artist, self.title, self.medium , self.year, self.owner.name, self.owner.location)
                              
class Marketplace:
  def __init__(self):
    self.listings = []
  def add_listing(self, new_listing):
    #self.add_listing = add_listing
    self.listings.append(new_listing)
  def remove_listing(self, expired_listing):
    #self.remove_listing = remove_listing
    self.listings.remove(expired_listing)
  def show_listings(self):
    #self.show_listings = show_listings
    for listing in self.listings:
      print(listing)
    

class client:
  def __init__(self, name, location, is_museum): 
    self.name = name
    self.is_museum = is_museum
    if is_museum:
      self.locaction = location
    else:
      self.location = "Private Collection"
  def sell_artwork(self, artwork, price):
      if artwork.owner == self:
        new_listing = Listing(artwork, price, self)
        veneer.add_listing(new_listing)
        
class Listing:
  def __init__(self, art, price, seller):
    self.art = art
    self.price = price
    self.seller = seller 
    def __repr__(self):
      return "{}, {}".format(self.art.title, self.price)
      
veneer = Marketplace()       
      
edytta = client("Edytta Halpirt", None, False)
moma = client("The MOMA", "New York", True)  

girl_with_mandolin = Art("Picasso, Pablo", "Girl with a Mandolin (Fanny Tellier)", "oil on canvas", 1910, edytta)                                  
#print(girl_with_mandolin)

edytta.sell_artwork(girl_with_mandolin, "$6M (USD)")

veneer.show_listings()

Hello, @blog9145668123.

Take a close look at your Listing class specifically at the indentation. :wink:

2 Likes

Thanks so much. I spent way to much time staring at this

2 Likes

You’re welcome. Let me give you a quick rundown on how I found it.
First, given what was printed (the object’s location in memory) I suspected there was no __repr__() or __str__() method for the List class.
Second, I looked at the List class, and quickly noticed the indentation issue.

Debugging should be a process rather than an eye strain. Make observations, and work your way through your code until you find where the unexpected behavior occurs.

Happy Coding!