You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
706 B
Python

"""
Created just to test the id of OOP for User representation. Kind of heavy on the memory usage side though.
"""
from typing import List
class User:
def __init__(self, id: int, name: str, freinds: List[int] = []) -> None:
self.id = id
self.name = name
self.friends = freinds
def __eq__(self, other):
if isinstance(other, User):
return self.id == other.id
else:
return False
def __repr__(self):
return f"User({self.id}, '{self.name}')"
class SuperUser(User):
def __init__(self, id: int, name: str, friends: List[int] = []):
super(SuperUser, self).__init__(id, name, friends)
self.admin = True