OOP in Python

OOP is a concept that helps simplifying your code and eases application development. It is especially useful in reusing your code. Object-oriented code enables reusing your code for sensors that use the communications interface. For example, all sensors that are equipped with a UART port could be grouped together using object-oriented code.

One example of OOP is the GPIO Zero library (https://www.raspberrypi.org/blog/gpio-zero-a-friendly-python-api-for-physical-computing/) used in previous chapters. In fact, everything is an object in Python.

Object-oriented code is especially helpful in collaboration with other people on a project. For example, you could implement a sensor driver using object-oriented code in Python and document ...

Get Python Programming with Raspberry Pi now with O’Reilly online learning.

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