57
57
58
58
* Use the ``help `` function to read the documentation for a module/class/function. As a standalone invocation,
59
59
you enter the help system and can explore various topics.
60
- * Use the ``dir `` function to list contents of the namespace, or attributes of an object if you pass one in
60
+ * Use the ``dir `` function to list contents of the namespace, or attributes of an object if you pass one in.
61
61
62
62
.. note ::
63
63
@@ -590,7 +590,7 @@ We can access members by position or name (name allows us to be more explicit)::
590
590
591
591
.. longtable: format: {>{\hangindent=1em\hangafter=1\raggedright\arraybackslash }p{.3\textwidth} l >{\hangindent=1em\hangafter=1\raggedright\arraybackslash }p{.3\textwidth}}
592
592
593
- .. table :: Tuple Methods
593
+ .. table :: Tuple Operations
594
594
595
595
================================== ========================= ============================================================
596
596
Operation Provided Result
@@ -675,7 +675,7 @@ Sets are useful because they provide *set operations*, such as union
675
675
676
676
.. longtable: format: {>{\hangindent=1em\hangafter=1\raggedright\arraybackslash }p{.25\textwidth} l >{\hangindent=1em\hangafter=1\raggedright\arraybackslash }p{.35\textwidth}}
677
677
678
- .. table :: Set Methods
678
+ .. table :: Set Operations
679
679
680
680
======================================= ========================= ============================================================
681
681
Operation Provided By Result
@@ -685,7 +685,7 @@ Sets are useful because they provide *set operations*, such as union
685
685
``s == s2 `` ``__eq__ `` Equality. Sets are equal or not equal
686
686
``"{}".format(s) `` ``__format__ `` String format of set
687
687
``s >= s2 `` ``__ge__ `` ``s `` in ``s2 `` (see ``.issuperset ``)
688
- ``s > s2 `` ``__gt__ `` Greater. Always `` False` ``
688
+ ``s > s2 `` ``__gt__ `` Strict superset (`` s >= s2 `` but `` s != s2 ``).
689
689
No hash ``__hash__ `` Set to ``None `` to ensure you can't insert in dictionary
690
690
``s &= s2 `` ``__iand__ `` Augmented (mutates ``s ``) intersection (see ``.intersection_update ``)
691
691
``s |= s2 `` ``__ior__ `` Augmented (mutates ``s ``) union (see ``.update ``)
@@ -694,7 +694,7 @@ Sets are useful because they provide *set operations*, such as union
694
694
``s ^= s2 `` ``__ixor__ `` Augmented (mutates ``s ``) xor (see ``.symmetric_difference_update ``)
695
695
``s <= s2 `` ``__le__ `` ``s2 `` in ``s `` (see ``.issubset ``)
696
696
``len(s) `` ``__len__ `` Length
697
- ``s < s2 `` ``__lt__ `` Less than. Always `` False ``
697
+ ``s < s2 `` ``__lt__ `` Strict subset (`` s <= s2 `` but `` s != s2 ``).
698
698
``s != s2 `` ``__ne__ `` Not equal
699
699
``s | s2 `` ``__or__ `` Set union (see ``.union ``)
700
700
``foo & s `` ``__rand__ `` Called if ``foo `` doesn't implement ``__and__ ``
@@ -732,9 +732,9 @@ Sets are useful because they provide *set operations*, such as union
732
732
``s.discard(item) `` Remove ``item `` from s (mutates ``s ``). No error on missing ``item ``
733
733
``s.intersection(s2) `` Return set with elements from both sets
734
734
``s.intersection_update(s2) `` Update ``s `` with members of ``s2 `` (mutates ``s ``)
735
- ``s.isdisjoint(s2) `` ``True `` is there is no intersection
736
- ``s.issubset(s2) `` All elements of ``s `` in ``s2 ``
737
- ``s.issuperset(s2) `` All elements of ``s2 `` in ``s2 ``
735
+ ``s.isdisjoint(s2) `` ``True `` if there is no intersection of these two sets
736
+ ``s.issubset(s2) `` `` True `` if all elements of ``s `` are in ``s2 ``
737
+ ``s.issuperset(s2) `` `` True `` if all elements of ``s2 `` are in ``s ``
738
738
``s.pop() `` Remove arbitrary item from s (mutates ``s ``). ``KeyError `` on missing ``item ``
739
739
``s.remove(item) `` Remove ``item `` from s (mutates ``s ``). ``KeyError `` on missing ``item ``
740
740
``s.symmetric_difference(s2) `` Return set with elements only in one of the sets
@@ -779,7 +779,7 @@ In the default namespace you have access to various callables:
779
779
``enumerate(seq, [start]) `` Return iterator of index, item tuple pairs. Index begins at ``start `` or ``0 `` (default)
780
780
``eval(source, globals=None, locals=None) `` Run ``source `` (expression string or result of ``compile ``) with globals and locals
781
781
``exec(source, globals=None, locals=None) `` Run ``source `` (statement string or result of ``compile ``) with globals and locals
782
- ``exit(code) `` Exit Python interpreter and return code
782
+ ``exit([ code] ) `` Exit Python interpreter and return code (default 0)
783
783
``filter([function], seq) `` Return iterator of items where ``function(item) `` is truthy (or ``item `` is truthy if ``function `` is missing)
784
784
``float(x) `` Convert string or number to float (call ``x.__float__() ``)
785
785
``format(obj, fmt) `` Format protocol (call ``obj.__format__(fmt) ``)
0 commit comments