Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our…

Follow publication

Member-only story

Try This to Keep Your Python Code Clean Forever

A set-and-forget technique to automatically fix your code.

Thuwarakesh Murallie
Towards AI
Published in
8 min read5 days ago

--

Photo by Katie Pearse on Unsplash

No one wants to do the boring stuff.

And keeping things tidy is not everyone’s favorite. — certainly not mine!

However, as programmers, we must agree to a common standard for two reasons. One, it helps others understand your code. The other is that it boosts your own productivity—especially when battling bugs.

The issue with Python is that it’s a very relaxed programming language. You have some room to code in your style. For instance, type safety is optional in Python, while it’s strict in languages like Java. We can talk about the semicolons, curly braces, and more like this.

But all of this contributes to one thing—perfectly working code that looks different from developer to developer.

Standards like PEP8 have evolved to bridge this gap. If you and I follow the standards, your code won’t look too different. So, you can work on mine, and I can work on yours in the future.

Yet, keeping the standards in mind and coding according to them isn’t easy, especially not with AI-aided coding, where you have little control over your codebase.

--

--

Published in Towards AI

The leading AI community and content platform focused on making AI accessible to all. Check out our new course platform: https://academy.towardsai.net/courses/beginner-to-advanced-llm-dev

Written by Thuwarakesh Murallie

Data Science Journalist & Independent Consultant

Responses (2)

Write a response