Learning_Python icon indicating copy to clipboard operation
Learning_Python copied to clipboard

Extend set documentation to include comparison-related and other native methods

Open icozma opened this issue 4 months ago • 0 comments

While reading the section on [Set Operations](https://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/DataStructures_III_Sets_and_More.html#Set-operations), I noticed that while the core set operations like union, intersection, and symmetric difference are well-covered, some of Python's built-in methods for set comparisons and related operations are either missing or only briefly mentioned.

Missing or underdocumented methods (examples):

  • isdisjoint(other) – checks if sets share no elements
  • issubset(other) / issuperset(other) – though subset/superset comparisons are described conceptually, the actual method calls are not fully illustrated
  • ==, !=, <, <=, >, >= – these operator-based comparisons are part of Python's set API but aren't referenced directly
  • copy(), discard(), clear(), pop() – while not strictly comparisons, these are common methods users expect to learn when exploring sets

Suggestion:

It would be valuable to extend the page with:

  • A short section explicitly titled "Set Comparison Methods" or "Set Relationship Checks"
  • Examples using both methods (issubset, isdisjoint, etc.) and operators (<=, <, ==, etc.)
  • A reference table listing all key set methods for completeness

This addition would greatly enhance the comprehensiveness of the tutorial and help readers understand the full power of Python sets.

Thanks again for the great work—happy to contribute examples or help if needed!

Best, Iulian

icozma avatar Aug 07 '25 08:08 icozma