emilydolson / python-red-black-trees

Red-black tree implementation in Python
Other
20 stars 5 forks source link

Add `__len__()` to RedBlackTree #11

Open Beakerboy opened 9 months ago

Beakerboy commented 9 months ago

The class has a size attribute so it makes sense to use the standard __len__() method to access it instead of relying on it being a public attribute.

Beakerboy commented 9 months ago

12 adds this. If you are okay with version-breaking changes, it’s probably better to make the count private.