-
Notifications
You must be signed in to change notification settings - Fork 0
Эффективность по памяти #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| class NodeState: | ||
| """Класс, представляющий состояние узла. Он может быть определен | ||
| в зависимости от структуры данных.""" | ||
| def __init__(self, data: Optional['NodeState'] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С питона 3.10 вместо data: Optional['NodeState'] = None можно писать:
data: NodeState | None = None
| :param state: Состояние узла. | ||
| """ | ||
| self.state: Optional[NodeState] = state | ||
| self.children: Dict[int, 'Node'] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Также в новых питонах нет необходимости импортировать Dict из typing можно просто dict писать, и типы данных не нужно в кавычках писать
|
|
||
| class PersistentMap(BasePersistent): | ||
| """Персистентный ассоциативный массив. | ||
| """A persistent associative array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Везде была дока на русском а тут почему-то на английском пошла
|
|
||
| def update_version(self, version): | ||
| """Обновляет текущую версию персистентной структуры данных до указанной. | ||
| def set_version_doubly_linked_list(self, version: int) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понятно зачем такой метод в базовом классе, и не правильное название, если это используется только в списке, то нужно этот метод в соответствующем классе прописать и там уже очевидно не нужно будет пояснение в виде _doubly_linked_list.
Улучшенная реализация по памяти всех персиснтентных структур с использованием B-деревьев. Все покрыто тестами и отлажено линтером