A private member is an attribute or method marked for internal use by its defining implementation. In Python examples, a leading underscore signals that clients should use the class's public interface instead. section 6.8 section 8.12
Keep members private when exposing them would:
- Return implementation objects such as linked-list nodes instead of useful client data. section 6.8
- Expose internal structure and make future implementation changes break client code. section 6.8
- Allow callers to access mutable data or bypass necessary edge-case checks. section 8.12
Internal search in a linked list
The _search method returns a node for use by the implementation, while a public method can expose only the result clients need. section 6.8
Private tree search
A tree can keep _search private and offer contains publicly, preventing clients from depending on tree nodes while preserving internal search logic. section 11.8











