Doubts about the Design of python Class

I am a beginner in python . I think of some questions when practicing the code, as follows:

there is now a User class that abstractly represents each user , and can have some attributes, such as this:

class UserModel:
    def __init__(self)
        self.users = []
    
    def all(self):
        return self.users
        

method 2: proceed directly on the User class, as shown by using classmethod , for example:

class User:
    def __init__(self, form):
        self.name = form.get("name", "")
        self.password = form.get("password", "")
    
    @classmethod
    def all(cls):
        users = [cls(form) for form in forms]
        return users

both methods can achieve the same function. Which method is better, or is there a better way to implement it? I would appreciate it if you could answer it.


I think I can register the instance in a class variable in _ _ new__

class User:
    users = []
    def __new__(cls, *args, **kwargs):
        instance = super().__new__(cls, *args, **kwargs)
        cls.users.append(instance)
        return instance
print(User.users)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30935-2bd21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30935-2bd21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?