Sort the users

Report a typo

Your friend has written a dataclass to store some basic information about the users of their website and to sort them by their id. Here it is:

from dataclasses import dataclass, field

@dataclass(order=True)
class User:
    sort_index: int = field(init=False)
    user_name: str
    user_id: int
        
    def __post_init__(self):
        ...

However, there's a line missing – type it in the field below (without indentation).

Enter a short text
___

Create a free account to access the full topic