From 2f6477aa20ff30c448733b9543a9cd119cf99654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 3 Aug 2023 09:55:33 +0200 Subject: [PATCH] Comment indentation fixes --- README.md | 62 +++++++++++++++++++++++++------------------------- index.html | 66 +++++++++++++++++++++++++++--------------------------- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 55af7e4..ec5b40e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Contents Main ---- ```python -if __name__ == '__main__': # Runs main() if file wasn't imported. +if __name__ == '__main__': # Runs main() if file wasn't imported. main() ``` @@ -29,19 +29,19 @@ if __name__ == '__main__': # Runs main() if file wasn't imported. List ---- ```python - = [] # Or: [from_inclusive : to_exclusive : ±step] + = [] # Or: [from_inclusive : to_exclusive : ±step] ``` ```python -.append() # Or: += [] -.extend() # Or: += +.append() # Or: += [] +.extend() # Or: += ``` ```python -.sort() # Sorts in ascending order. -.reverse() # Reverses the list in-place. - = sorted() # Returns a new sorted list. - = reversed() # Returns reversed iterator. +.sort() # Sorts in ascending order. +.reverse() # Reverses the list in-place. + = sorted() # Returns a new sorted list. + = reversed() # Returns reversed iterator. ``` ```python @@ -57,12 +57,12 @@ list_of_chars = list() * **Module [operator](#operator) provides functions itemgetter() and mul() that offer the same functionality as [lambda](#lambda) expressions above.** ```python -.insert(, ) # Inserts item at index and moves the rest to the right. - = .pop([]) # Removes and returns item at index or from the end. - = .count() # Returns number of occurrences. Also works on strings. - = .index() # Returns index of the first occurrence or raises ValueError. -.remove() # Removes first occurrence of the item or raises ValueError. -.clear() # Removes all items. Also works on dictionary and set. +.insert(, ) # Inserts item at index and moves the rest to the right. + = .pop([]) # Removes and returns item at index or from the end. + = .count() # Returns number of occurrences. Also works on strings. + = .index() # Returns index of the first occurrence or raises ValueError. +.remove() # Removes first occurrence of the item or raises ValueError. +.clear() # Removes all items. Also works on dictionary and set. ``` @@ -144,9 +144,9 @@ Tuple ----- **Tuple is an immutable and hashable list.** ```python - = () # Empty tuple. - = (,) # Or: , - = (, [, ...]) # Or: , [, ...] + = () # Empty tuple. + = (,) # Or: , + = (, [, ...]) # Or: , [, ...] ``` ### Named Tuple @@ -170,9 +170,9 @@ Range ----- **Immutable and hashable sequence of integers.** ```python - = range(stop) # range(to_exclusive) - = range(start, stop) # range(from_inclusive, to_exclusive) - = range(start, stop, ±step) # range(from_inclusive, to_exclusive, ±step_size) + = range(stop) # range(to_exclusive) + = range(start, stop) # range(from_inclusive, to_exclusive) + = range(start, stop, ±step) # range(from_inclusive, to_exclusive, ±step_size) ``` ```python @@ -192,10 +192,10 @@ for i, el in enumerate( [, i_start]): Iterator -------- ```python - = iter() # `iter()` returns unmodified iterator. - = iter(, to_exclusive) # A sequence of return values until 'to_exclusive'. - = next( [, default]) # Raises StopIteration or returns 'default' on end. - = list() # Returns a list of iterator's remaining elements. + = iter() # `iter()` returns unmodified iterator. + = iter(, to_exclusive) # A sequence of return values until 'to_exclusive'. + = next( [, default]) # Raises StopIteration or returns 'default' on end. + = list() # Returns a list of iterator's remaining elements. ``` ### Itertools @@ -204,19 +204,19 @@ import itertools as it ``` ```python - = it.count(start=0, step=1) # Returns updated value endlessly. Accepts floats. - = it.repeat( [, times]) # Returns element endlessly or 'times' times. - = it.cycle() # Repeats the sequence endlessly. + = it.count(start=0, step=1) # Returns updated value endlessly. Accepts floats. + = it.repeat( [, times]) # Returns element endlessly or 'times' times. + = it.cycle() # Repeats the sequence endlessly. ``` ```python - = it.chain(, [, ...]) # Empties collections in order (figuratively). - = it.chain.from_iterable() # Empties collections inside a collection in order. + = it.chain(, [, ...]) # Empties collections in order (figuratively). + = it.chain.from_iterable() # Empties collections inside a collection in order. ``` ```python - = it.islice(, to_exclusive) # Only returns first 'to_exclusive' elements. - = it.islice(, from_inc, …) # `to_exclusive, +step_size`. Indices can be None. + = it.islice(, to_exclusive) # Only returns first 'to_exclusive' elements. + = it.islice(, from_inc, …) # `to_exclusive, +step_size`. Indices can be None. ``` diff --git a/index.html b/index.html index 93a228b..ce96312 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -96,20 +96,20 @@ -

#Main

if __name__ == '__main__':     # Runs main() if file wasn't imported.
+

#Main

if __name__ == '__main__':      # Runs main() if file wasn't imported.
     main()
 
-

#List

<list> = <list>[<slice>]       # Or: <list>[from_inclusive : to_exclusive : ±step]
+

#List

<list> = <list>[<slice>]        # Or: <list>[from_inclusive : to_exclusive : ±step]
 
-
<list>.append(<el>)            # Or: <list> += [<el>]
-<list>.extend(<collection>)    # Or: <list> += <collection>
+
<list>.append(<el>)             # Or: <list> += [<el>]
+<list>.extend(<collection>)     # Or: <list> += <collection>
 
-
<list>.sort()                  # Sorts in ascending order.
-<list>.reverse()               # Reverses the list in-place.
-<list> = sorted(<collection>)  # Returns a new sorted list.
-<iter> = reversed(<list>)      # Returns reversed iterator.
+
<list>.sort()                   # Sorts in ascending order.
+<list>.reverse()                # Reverses the list in-place.
+<list> = sorted(<collection>)   # Returns a new sorted list.
+<iter> = reversed(<list>)       # Returns reversed iterator.
 
sum_of_elements  = sum(<collection>)
 elementwise_sum  = [sum(pair) for pair in zip(list_a, list_b)]
@@ -123,12 +123,12 @@ list_of_chars    = list(<str>)
 
  • For details about sorted(), min() and max() see sortable.
  • Module operator provides functions itemgetter() and mul() that offer the same functionality as lambda expressions above.
  • -
    <list>.insert(<int>, <el>)     # Inserts item at index and moves the rest to the right.
    -<el>  = <list>.pop([<int>])    # Removes and returns item at index or from the end.
    -<int> = <list>.count(<el>)     # Returns number of occurrences. Also works on strings.
    -<int> = <list>.index(<el>)     # Returns index of the first occurrence or raises ValueError.
    -<list>.remove(<el>)            # Removes first occurrence of the item or raises ValueError.
    -<list>.clear()                 # Removes all items. Also works on dictionary and set.
    +
    <list>.insert(<int>, <el>)      # Inserts item at index and moves the rest to the right.
    +<el>  = <list>.pop([<int>])     # Removes and returns item at index or from the end.
    +<int> = <list>.count(<el>)      # Returns number of occurrences. Also works on strings.
    +<int> = <list>.index(<el>)      # Returns index of the first occurrence or raises ValueError.
    +<list>.remove(<el>)             # Removes first occurrence of the item or raises ValueError.
    +<list>.clear()                  # Removes all items. Also works on dictionary and set.
     

    #Dictionary

    <view> = <dict>.keys()                          # Coll. of keys that reflects changes.
     <view> = <dict>.values()                        # Coll. of values that reflects changes.
    @@ -182,9 +182,9 @@ Counter({'blue': 3
    -

    #Tuple

    Tuple is an immutable and hashable list.

    <tuple> = ()                                # Empty tuple.
    -<tuple> = (<el>,)                           # Or: <el>,
    -<tuple> = (<el_1>, <el_2> [, ...])          # Or: <el_1>, <el_2> [, ...]
    +

    #Tuple

    Tuple is an immutable and hashable list.

    <tuple> = ()                               # Empty tuple.
    +<tuple> = (<el>,)                          # Or: <el>,
    +<tuple> = (<el_1>, <el_2> [, ...])         # Or: <el_1>, <el_2> [, ...]
     
    @@ -201,9 +201,9 @@ Point(x=1, y=2
    -

    #Range

    Immutable and hashable sequence of integers.

    <range> = range(stop)                       # range(to_exclusive)
    -<range> = range(start, stop)                # range(from_inclusive, to_exclusive)
    -<range> = range(start, stop, ±step)         # range(from_inclusive, to_exclusive, ±step_size)
    +

    #Range

    Immutable and hashable sequence of integers.

    <range> = range(stop)                      # range(to_exclusive)
    +<range> = range(start, stop)               # range(from_inclusive, to_exclusive)
    +<range> = range(start, stop, ±step)        # range(from_inclusive, to_exclusive, ±step_size)
     
    @@ -214,24 +214,24 @@ Point(x=1, y=2 ...
    -

    #Iterator

    <iter> = iter(<collection>)                 # `iter(<iter>)` returns unmodified iterator.
    -<iter> = iter(<function>, to_exclusive)     # A sequence of return values until 'to_exclusive'.
    -<el>   = next(<iter> [, default])           # Raises StopIteration or returns 'default' on end.
    -<list> = list(<iter>)                       # Returns a list of iterator's remaining elements.
    +

    #Iterator

    <iter> = iter(<collection>)                # `iter(<iter>)` returns unmodified iterator.
    +<iter> = iter(<function>, to_exclusive)    # A sequence of return values until 'to_exclusive'.
    +<el>   = next(<iter> [, default])          # Raises StopIteration or returns 'default' on end.
    +<list> = list(<iter>)                      # Returns a list of iterator's remaining elements.
     

    Itertools

    import itertools as it
     
    -
    <iter> = it.count(start=0, step=1)          # Returns updated value endlessly. Accepts floats.
    -<iter> = it.repeat(<el> [, times])          # Returns element endlessly or 'times' times.
    -<iter> = it.cycle(<collection>)             # Repeats the sequence endlessly.
    +
    <iter> = it.count(start=0, step=1)         # Returns updated value endlessly. Accepts floats.
    +<iter> = it.repeat(<el> [, times])         # Returns element endlessly or 'times' times.
    +<iter> = it.cycle(<collection>)            # Repeats the sequence endlessly.
     
    -
    <iter> = it.chain(<coll>, <coll> [, ...])   # Empties collections in order (figuratively).
    -<iter> = it.chain.from_iterable(<coll>)     # Empties collections inside a collection in order.
    +
    <iter> = it.chain(<coll>, <coll> [, ...])  # Empties collections in order (figuratively).
    +<iter> = it.chain.from_iterable(<coll>)    # Empties collections inside a collection in order.
     
    -
    <iter> = it.islice(<coll>, to_exclusive)    # Only returns first 'to_exclusive' elements.
    -<iter> = it.islice(<coll>, from_inc, …)     # `to_exclusive, +step_size`. Indices can be None.
    +
    <iter> = it.islice(<coll>, to_exclusive)   # Only returns first 'to_exclusive' elements.
    +<iter> = it.islice(<coll>, from_inc, …)    # `to_exclusive, +step_size`. Indices can be None.
     

    #Generator

    • Any function that contains a yield statement returns a generator.
    • @@ -2930,7 +2930,7 @@ $ deactivate # Deactivates virtual e