Last active
October 6, 2022 16:19
-
-
Save alexey-goloburdin/0cfbf978eb47201e40d6420fc703f563 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from typing import NamedTuple | |
class Group(NamedTuple): | |
id: int | |
name: str | |
class Client(NamedTuple): | |
id: int | |
group: Group | |
payment_type: int | |
last_authorized: datetime | |
def get_client_group_name(client: Client) -> str: | |
return client.group.name | |
client = Client( | |
id=1, | |
group=Group(id=22, name="Постоянный покупатель"), | |
payment_type=28, | |
last_authorized=datetime(2017, 5, 1) | |
) | |
print(get_client_group_name(client)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment