garyns / pigpio-dht

DHT11 Temperature and Humidity Sensor using pigpio
GNU General Public License v3.0
14 stars 6 forks source link

__ causes unnecessary name mangling #3

Closed Blindfreddy closed 4 years ago

Blindfreddy commented 4 years ago

Is there a (good) reason to use the double underscore at the start of the methods in DHTXX, e.g. def __read(self) ?

As per PEP8 this causes name mangling and often causes trouble in subclasses....

refer https://stackoverflow.com/questions/1301346/what-is-the-meaning-of-single-and-double-underscore-before-an-object-name

and

https://stackoverflow.com/questions/6930144/underscore-vs-double-underscore-with-variables-and-methods

garyns commented 4 years ago

No good reasons, other than it's legacy code I wrote a long while ago that I'm modularising. I don't like 2 x _ as a general rule, so I'll flag removing them as a cleanup exercise.

garyns commented 4 years ago

Cleaned up. Closing.