write a very good chatgpt prompt for cleaning a code according industry standards
- User
write a very good chatgpt prompt for cleaning a code according industry standards
- Assistant
Certainly! When creating a prompt for ChatGPT to help clean code according to industry standards, it's essential to be clear about the programming language, the specific issues you're facing, and the desired outcome. Here's a comprehensive prompt that you can use:
Prompt:
I have a piece of code written in [Programming Language] that I need help cleaning up to meet industry standards. The code contains several issues, including inconsistent naming conventions, lack of comments, potential bugs, and inefficient algorithms. Here are the specific areas I want you to focus on:
- Readability: Improve naming conventions for variables and functions to make them more descriptive and consistent.
- : Add appropriate comments to explain complex parts of the code, including function purposes and algorithm logic.
- User
Refine the following prompt so that ChatGPT or LLMs can generate improved results. Consider aspects such as grammar, clarity, and detail. If necessary, add more relevant information to the prompt to enhance its effectiveness. Maintain the original style
clean the following code so it looks more cleaner and readable and maintable. make sure to not change any functionality and core logic of te code. please make sure to give only the final code. - Assistant
Here's a refined version of your prompt that improves grammar, clarity, and detail while preserving the original style:
Please clean the following code to make it more aesthetically pleasing, readable, and maintainable. Ensure that no functionality or core logic of the code is altered. I would like you to provide only the final version of the cleaned code, without any additional explanations or comments. Thank you!This version enhances clarity, corrects grammatical errors, and maintains the original intent of your request.
- User
i have 4 python functions
function 1 calls function 2 and function 2 calls function 3 and so on .
now i want to add exception handling in all functions.
first method : catch every exception and return only True or False depending on the exception with proper logging and based on the output create new exception blocks in parent function.
second method: catch exception and raise it simply with logging
which is the correct method, first or second. if there is better way please let me know
- Assistant
- User
explain Granular Exception Handling in python
- Assistant