BeatsuDev / tibber.py

An UNOFFICIAL python wrapper for the nordic electricity company Tibber's API.
MIT License
17 stars 2 forks source link

[FEATURE] Add informative __str__ and __repr__ methods #21

Open BeatsuDev opened 1 year ago

BeatsuDev commented 1 year ago

Describe the solution you'd like

Add __str__ and __repr__ methods that better tell what the object is. For example:

>>> print(tibber.homes[0])
<tibber.types.home.TibberHome object at 0x000002C17D154B20>
>>> 
>>> # Instead:
>>> print(tibber.homes[0])
VitaHuset owned by Arya Stark at Winterfell Castle 1.
>>>
BeatsuDev commented 10 months ago

Just updating this issue with a note: A lot of classes still require these descriptive text representations.