Generative AI snippets

How to ask Chat GPT to simplify and apply naming conventions to your code

For this purpose, you can use this template and personalize it to your needs.

Please act as a Senior Developer. I have a Python script that I've been working on, and I'm looking to make it more readable and maintainable by simplifying the code and ensuring it follows proper naming conventions. I am particularly interested in adhering to PEP 8 standards for naming variables, functions, classes, etc., but I'm also open to any additional suggestions you might have for improving code clarity and efficiency. Here are some specifics I'm struggling with:

  • I have several functions and variables named inconsistently, and I need help renaming them to follow the snake_case naming convention for functions and variables and CamelCase for classes.
  • My code contains nested functions and complex logic that could be simplified or refactored for better readability.
  • I'm using list comprehensions and lambda functions in some places, but I'd like to know if they're the most efficient or readable option for my goal.
Below is a snippet of my code:

x = 0

I would appreciate advice on refiling this code snippet to align it with best practices and any general tips on applying these principles to the rest of my script. Thank you for your assistance!

Back to Generative AI cookbook page