Write Better Python Functions Simple but effective tips to write better Python fucntions: Write Functions That Do Only One Thing Add Type Hints to Improve Maintainability Accept Only the Arguments You Actually Need Enforce Keyword-Only Arguments to Minimize Errors Don't Return Lists From Functions; Use Generators Instead