From e242659d0dea91dcb4bc0a88c6992751a9db5dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 14 Apr 2024 12:48:04 +0200 Subject: [PATCH] Context manager, Operator, NumPy --- README.md | 6 +++--- index.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 56ad5ac..cba74c3 100644 --- a/README.md +++ b/README.md @@ -1199,7 +1199,7 @@ class Counter: ``` ### Context Manager -* **With statements only work with objects that have enter() and exit() special methods.** +* **With statements only work on objects that have enter() and exit() special methods.** * **Enter() should lock the resources and optionally return an object.** * **Exit() should release the resources.** * **Any exception that happens inside the with block is passed to the exit() method.** @@ -2160,7 +2160,7 @@ Operator ```python import operator as op = op.not_() # or, and, not (or/and missing) - = op.eq/ne/lt/le/gt/ge/contains/is_(, ) # ==, !=, <, <=, >, >=, in, is + = op.eq/ne/lt/le/gt/ge/is_/contains(, ) # ==, !=, <, <=, >, >=, is, in = op.or_/xor/and_(, ) # |, ^, & = op.lshift/rshift(, ) # <<, >> = op.add/sub/mul/truediv/floordiv/mod(, ) # +, -, *, /, //, % @@ -2666,7 +2666,7 @@ import numpy as np ```python = np.copy/abs/sqrt/log/int64() # Returns new array of the same shape. - = .sum/max/mean/argmax/all(axis) # Passed dimension gets aggregated. + = .sum/max/mean/argmax/all(axis) # Aggregates specified dimension. = np.apply_along_axis(, axis, ) # Func can return a scalar or array. ``` diff --git a/index.html b/index.html index 743f6e3..c7e6c64 100644 --- a/index.html +++ b/index.html @@ -1017,7 +1017,7 @@ Z = dataclasses.make_dataclass('Z', [1, 2, 3)

Context Manager

    -
  • With statements only work with objects that have enter() and exit() special methods.
  • +
  • With statements only work on objects that have enter() and exit() special methods.
  • Enter() should lock the resources and optionally return an object.
  • Exit() should release the resources.
  • Any exception that happens inside the with block is passed to the exit() method.
  • @@ -1781,7 +1781,7 @@ CompletedProcess(args=['bc', #Operator

    Module of functions that provide the functionality of operators. Functions are ordered by operator precedence, starting with least binding.

    import operator as op
     <bool> = op.not_(<obj>)                                         # or, and, not (or/and missing)
    -<bool> = op.eq/ne/lt/le/gt/ge/contains/is_(<obj>, <obj>)        # ==, !=, <, <=, >, >=, in, is
    +<bool> = op.eq/ne/lt/le/gt/ge/is_/contains(<obj>, <obj>)        # ==, !=, <, <=, >, >=, is, in
     <obj>  = op.or_/xor/and_(<int/set>, <int/set>)                  # |, ^, &
     <int>  = op.lshift/rshift(<int>, <int>)                         # <<, >>
     <obj>  = op.add/sub/mul/truediv/floordiv/mod(<obj>, <obj>)      # +, -, *, /, //, %
    @@ -2190,7 +2190,7 @@ $ snakeviz test.prof                                            # Or: <array>.T
     
    <array> = np.copy/abs/sqrt/log/int64(<array>)           # Returns new array of the same shape.
    -<array> = <array>.sum/max/mean/argmax/all(axis)         # Passed dimension gets aggregated.
    +<array> = <array>.sum/max/mean/argmax/all(axis)         # Aggregates specified dimension.
     <array> = np.apply_along_axis(<func>, axis, <array>)    # Func can return a scalar or array.
     
    <array> = np.concatenate(<list_of_arrays>, axis=0)      # Links arrays along first axis (rows).