Skip to content

22ПИ-1 Овсянников#18

Open
sh1ronchik wants to merge 6 commits intoryabchi:mainfrom
sh1ronchik:22pi-1/ovsyannikov
Open

22ПИ-1 Овсянников#18
sh1ronchik wants to merge 6 commits intoryabchi:mainfrom
sh1ronchik:22pi-1/ovsyannikov

Conversation

@sh1ronchik
Copy link
Copy Markdown

No description provided.

return

# Check if the argument is a task description or a task index
try:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

в try except старайся оборачивать только тот участок кода, который действительно может упасть

полтона кода писать в рамках этих операторов плохая практика - часто возникают проблемы с локализацией ошибки и тд

await update.message.reply_text("Please provide a task description or a task index.")
return

# Check if the argument is a task description or a task index
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

подумай как лучше переформатировать этот код, много повторений и см комменты ниже

async def view_tasks(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""View all tasks in the user's list."""
user = update.effective_user
tasks = TASKS.get(user.id, [])
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

я бы вынес в отдельную функцию, так ты таскаешь дефолтное поведение везде

а по хорошему - вообще бы сделал отдельный класс или модуль storage с которым оперировал через методы.функции

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