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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.