Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 1, 2021 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/bf3d2c960a1bb45ab39de03cc94e80c4 to your computer and use it in GitHub Desktop.
Save parzibyte/bf3d2c960a1bb45ab39de03cc94e80c4 to your computer and use it in GitHub Desktop.
"""
https://parzibyte.me/blog
"""
class Juego:
def __init__(self, nombre, precio):
self.nombre = nombre
self.precio = precio
def __eq__(self, otro_juego):
# Aquí puedes comparar cualquier cosa de los dos objetos. Debes regresar un Booleano
print("Llamada a __eq__!")
return otro_juego.nombre == self.nombre and otro_juego.precio == self.precio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment