Skip to content

3. Вербицкий Владимир Ильич. 613. - #44

Closed
WWWVovan wants to merge 10 commits into
python-department:mainfrom
WWWVovan:main
Closed

WWWVovan wants to merge 10 commits into
python-department:mainfrom
WWWVovan:main

Conversation

@WWWVovan

Copy link
Copy Markdown

No description provided.

@WWWVovan WWWVovan changed the title 1. Вербицкий Владимир Ильич. 613. 2. Вербицкий Владимир Ильич. 613. Oct 4, 2026
@WWWVovan WWWVovan closed this Oct 12, 2026
@WWWVovan WWWVovan reopened this Oct 12, 2026
@WWWVovan WWWVovan changed the title 2. Вербицкий Владимир Ильич. 613. 3. Вербицкий Владимир Ильич. 613. Oct 12, 2026
Comment thread src/part1/snowflake.py
return None

snowflake_id = (
(timestamp_ms << (NODE_ID_BITS + SEQUENCE_ID_BITS))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вычисление сдвига дублировано в функции decode_timestamp_ms. Это может быть опасно, так как если логика поменяется, то надо будет исправлять в 2х местах, а это можно забыть, поэтому лучше было вынести вычисление в отдельную константу.
Пункт S1, минус балл.

Comment thread src/part2/crud.py

def read_product(storage: list[Product], product_id: int) -> Product | None:

for product in storage:

@Avshugan Avshugan Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Цикл:

for index, product in enumerate(storage):
        if product[PRODUCT_ID_INDEX] == product_id:

встречается несколько раз, лучше было бы использовать везде read_product. Код был бы понятнее.
Пункт S1

Comment thread src/part3/run_admin.py
match commands:
case ["help"]:
show_help()
return True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Думаю можно было бы вынести return True в конец функции, код был бы чище

@WWWVovan WWWVovan closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants