##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 10\10.1448 - No Title.py
# Description: No Title
##############################################################################
class Name:
def __init__(self, name):
if name is None or not name.strip():
raise ValueError("Name cannot be null or blank")
self.name = name
self.key = name.strip().lower()
def __str__(self):
return self.name
def __repr__(self):
return f"<Class {type(self).__name__} in 0x{id(self):x} Name: {self.name} Key: {self.key}>"
def __eq__(self, other):
print("__eq__ Called")
return self.name == other.name
def __lt__(self, other):
print("__lt__ Called")
return self.name < other.name