Skip to content

5x12/g-clean-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Table of Contents

  • Introduction
  • Variables
    • Variable names should reveal intent
    • Use meaningful and pronounceable variable names
    • Use the same vocabulary for the same type of variable
    • Avoid magic numbers and magic strings
    • Use variables to keep code "DRY" ("Don't Repeat Yourself")
    • Use explanatory variables
    • Avoid mental mapping
    • Don't add unneeded context
  • Dispensables
    • Avoid comments
    • Remove dead code
    • Avoid print statements (even glorified print statements such as df.head(), df.describe(), df.plot())
  • Functions
    • Use functions to keep code "DRY"
    • Functions should do one thing
    • Functions should only be one level of abstraction
    • Function names should say what they do
    • Use type hints to improve readability
    • Avoid side effects
    • Avoid unexpected side effects on values passed as function parameters
    • Function arguments (2 or fewer ideally)
    • Use default arguments instead of short circuiting or conditionals
    • Don't use flags as function parameters

Introduction

Clean code practices (from Clean Code and Refactoring) adapted for machine learning / data science workflows in Python. This is not a style guide. It's a guide to producing readable, reusable, and refactorable software.

Targets Python3.7+

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published