Tuesday, 14 February 2023

Best Practices: How to Write Clean Python Code

Best Practices: How to Write Clean Python Code

Following are things one should consider while writing machine learning code.

1) Right names 

One should provide correct names to variables, functions, data frames, etc. so that one can easily interpret the meaning.

2) Consistent with naming conventions

Always follow the same writing convention across the code.

3) Proper documentation and comments

One should add comments to provide a description of the task to be performed by code.

4) Avoid using redundant text while writing code or providing any description; -Text / name must be easily interpretable 

5) Avoid Duplication: Avoid duplication in code by using the same function for one task instead of writing different functions, also applies to other things 

No comments:

Post a Comment