© Sunil Kapil 2019
Sunil KapilClean Pythonhttps://doi.org/10.1007/978-1-4842-4878-2_3

3. Writing Better Functions and Classes

Sunil Kapil1 
(1)
Sunnyvale, CA, USA
 

Functions and classes are core parts of the Python language. All the code you write in the professional world consists of functions and classes. In this chapter, you will learn about best practices that will help to make your code more readable and cleaner.

While writing functions and classes, it’s important you think about the boundaries and structures of your functions/classes. Having a clear understanding of the use cases that your function or class is trying to solve will help you to write better classes and functions. Always keep in mind the philosophy of the single responsibility ...

Get Clean Python: Elegant Coding in Python now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.