Just A Small Guideline

Feel free to browse the site. Don't be afraid to leave comments, they're supportive.
Please follow me on Twitter @ehldmnt and retweet my posts.

Sunday, May 12, 2013

Organizing Your Python Scripts: A Guide For All Who Want to have neater code

When organizing your python scripts, it is good to have certain layout when you're programming, as to reduce the amount of stress about the order of things later. I'll define here some rules for functions, classes, and variables, and some tips for how you'd probably code your scripts. I'll be updating this list as things come to mind.

Tips and Tricks


  • Always write your imports at the top of your script.
  • Always define your functions at the beginning of your scripts and call the functions that are called by others before them.
  • Always make sure that you call your variables before you call your functions.
  • Always make sure to comment your code if you don't think you'll remember what it's doing.
  • Always use docstrings to explain what any piece of your code is doing.
  • Always define proprietorship at the top of every script that you write, the name of the script, and the license. 
  • Always use consistent indentation, not matter what, or expect indentation errors.

No comments: