Python Tech

Комментирование кода с примерами на английском языке

Основные правила

Писать максимально короткие комментарии.

Комментировать только код, который требует объяснений, самые сложные и неочевидные места. Обычно по коду сразу видно, что он делает.

В комментарии описать, почему использовано именно это решение, а не другое.

Полезные конструкции и фразы

Initialize: “Initialize counter to zero.”
Check: “Check if the input is valid.”
Calculate: “Calculate the sum of all elements.”
Loop through: “Loop through the list of items.”
Handle: “Handle exceptions for file operations.”
Return: “Return the result of the calculation.”
Convert: “Convert string to integer.”
Update: “Update user information in the database.”
Remove: “Remove duplicate entries.”
Perform: “Perform data validation.”
Fetch: “Fetch data from the API.”
Sort: “Sort the array in ascending order.”
Append: “Append new elements to the list.”
Create: “Create a new instance of the class.”
Assign: “Assign default values to variables.”

Примеры фраз для автотестов

“Setup test environment.”
“Tear down after tests.”
“Assert the result matches expected output.”
“Verify element is present on the page.”
“Simulate user login.”
“Check API response status code.”
“Mock external service for testing.”
“Validate form input fields.”
“Capture screenshot on failure.”
“Initialize webdriver instance.”
“Navigate to homepage.”
“Click on submit button.”
“Select option from dropdown.”
“Wait for element to be visible.”
“Check if checkbox is selected.”
“Compare current URL with expected URL.”
“Log test execution details.”
“Retry failed tests.”
“Record video of test session.”
“Generate test report.”

Примеры фраз для data science

“Load dataset from CSV file.”
“Clean missing data.”
“Encode categorical variables.”
“Split data into train and test sets.”
“Apply feature scaling.”
“Train machine learning model.”
“Evaluate model performance.”
“Plot confusion matrix.”
“Visualize data distribution.”
“Perform exploratory data analysis.”
“Optimize hyperparameters.”
“Deploy model to production.”
“Update model with new data.”
“Calculate accuracy score.”
“Plot ROC curve.”
“Extract features from text.”
“Aggregate results by category.”
“Normalize data for comparison.”
“Reduce dimensionality with PCA.”
“Cluster data into groups.”
“Predict outcomes for new data.”
“Log model training metrics.”
“Save model to disk.”
“Load pre-trained model.”
“Visualize decision boundaries.”
“Analyze feature importance.”
“Handle imbalanced dataset.”
“Perform cross-validation.”
“Identify outliers in data.”
“Generate synthetic data for testing.”

Вставить формулу как
Блок
Строка
Дополнительные настройки
Цвет формулы
Цвет текста
#333333
Используйте LaTeX для набора формулы
Предпросмотр
\({}\)
Формула не набрана
Вставить