I'm trying to figure out the best way to design a couple of classes. I'm pretty new to Python (and OOP in general) and just want to make sure that I'm doing this right. I have two classes: "Users" and "User".
class User(object):
def __init__(self):
pass
class Users(object):
def __init__(self):
self.users = []
def add(self, user_id, email):
u = User()
u.user_id = user_id
u.email = email
self.users.append(u)
users = Users()
users.add(user_id = 1, email = '[email protected]')
If I want to retrieve my users, I use:
for u in users.users:
print u.email
"users.users" seems to be a bit redundant. Am I doing this right?