Veneer Project - .show_listing() doesn't work

Hello everyone,

I’ve been working on the Veneer project. When I use the .show_listing() method it prints (<main.Listing object at 0x7fb84bee2e10>).

I’ll appreciate it if anyone can tell me what I’m doing wrong.

Below 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 self.artist + ". " + self.title + ". " + str(self.year) + ", " + self.medium +". " + self.owner.name + ', ' + self.owner.location

class Marketplace:
  def __init__(self):
    self.listings = []
  
  def add_listing(self, new_listing):
    self.listings.append(new_listing)

  def remove_listing(self, deleted_list):
    self.listings.remove(deleted_list)

  def show_listing(self):
    for i in self.listings:
      print(i)

class Client:
  def __init__(self, name, location, is_museum):
    self.name = name
    self.is_museum = is_museum
    if is_museum:
      self.location = 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 __rerp__(self):
    return '%s, %s.' % (self.art.title, self.price)


veneer = Marketplace()

veneer.show_listing()

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_listing()


what you see there is default representation. While Listing implements a __repr__. so there might be a problem there. And sure enough when we inspect your magic method:

def __rerp__(self):

I see a problem, you to?

1 Like

I’m sorry but I don’t understand where the problem is

Now I do. I have to pay attention to typos because they will be the end of me :rofl:

Thank you! :smiley:

2 Likes