---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redundant base
 --> FURB163.py:4:1
  |
3 | # Errors
4 | math.log(1, 2)
  | ^^^^^^^^^^^^^^
5 | math.log(1, 10)
6 | math.log(1, math.e)
  |
help: Replace with `math.log2(1)`
  |
3 | # Errors
  - math.log(1, 2)
4 + math.log2(1)
5 | math.log(1, 10)
  |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
 --> FURB163.py:5:1
  |
3 | # Errors
4 | math.log(1, 2)
5 | math.log(1, 10)
  | ^^^^^^^^^^^^^^^
6 | math.log(1, math.e)
7 | foo = ...
  |
help: Replace with `math.log10(1)`
  |
4 | math.log(1, 2)
  - math.log(1, 10)
5 + math.log10(1)
6 | math.log(1, math.e)
  |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log(1)` over `math.log` with a redundant base
 --> FURB163.py:6:1
  |
4 | math.log(1, 2)
5 | math.log(1, 10)
6 | math.log(1, math.e)
  | ^^^^^^^^^^^^^^^^^^^
7 | foo = ...
8 | math.log(foo, 2)
  |
help: Replace with `math.log(1)`
  |
5 | math.log(1, 10)
  - math.log(1, math.e)
6 + math.log(1)
7 | foo = ...
  |

FURB163 [*] Prefer `math.log2(foo)` over `math.log` with a redundant base
  --> FURB163.py:8:1
   |
 6 | math.log(1, math.e)
 7 | foo = ...
 8 | math.log(foo, 2)
   | ^^^^^^^^^^^^^^^^
 9 | math.log(foo, 10)
10 | math.log(foo, math.e)
   |
help: Replace with `math.log2(foo)`
  |
7 | foo = ...
  - math.log(foo, 2)
8 + math.log2(foo)
9 | math.log(foo, 10)
  |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(foo)` over `math.log` with a redundant base
  --> FURB163.py:9:1
   |
 7 | foo = ...
 8 | math.log(foo, 2)
 9 | math.log(foo, 10)
   | ^^^^^^^^^^^^^^^^^
10 | math.log(foo, math.e)
11 | math.log(1, 2.0)
   |
help: Replace with `math.log10(foo)`
   |
8  | math.log(foo, 2)
   - math.log(foo, 10)
9  + math.log10(foo)
10 | math.log(foo, math.e)
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log(foo)` over `math.log` with a redundant base
  --> FURB163.py:10:1
   |
 8 | math.log(foo, 2)
 9 | math.log(foo, 10)
10 | math.log(foo, math.e)
   | ^^^^^^^^^^^^^^^^^^^^^
11 | math.log(1, 2.0)
12 | math.log(1, 10.0)
   |
help: Replace with `math.log(foo)`
   |
9  | math.log(foo, 10)
   - math.log(foo, math.e)
10 + math.log(foo)
11 | math.log(1, 2.0)
   |

FURB163 [*] Prefer `math.log2(1)` over `math.log` with a redundant base
  --> FURB163.py:11:1
   |
 9 | math.log(foo, 10)
10 | math.log(foo, math.e)
11 | math.log(1, 2.0)
   | ^^^^^^^^^^^^^^^^
12 | math.log(1, 10.0)
   |
help: Replace with `math.log2(1)`
   |
10 | math.log(foo, math.e)
   - math.log(1, 2.0)
11 + math.log2(1)
12 | math.log(1, 10.0)
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
  --> FURB163.py:12:1
   |
10 | math.log(foo, math.e)
11 | math.log(1, 2.0)
12 | math.log(1, 10.0)
   | ^^^^^^^^^^^^^^^^^
13 |
14 | # OK
   |
help: Replace with `math.log10(1)`
   |
11 | math.log(1, 2.0)
   - math.log(1, 10.0)
12 + math.log10(1)
13 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log(yield)` over `math.log` with a redundant base
  --> FURB163.py:49:11
   |
47 | # https://github.com/astral-sh/ruff/issues/18747
48 | def log():
49 |     yield math.log((yield), math.e)
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `math.log(yield)`
   |
48 | def log():
   -     yield math.log((yield), math.e)
49 +     yield math.log((yield))
50 |
   |

FURB163 [*] Prefer `math.log(yield from x)` over `math.log` with a redundant base
  --> FURB163.py:53:11
   |
52 | def log():
53 |     yield math.log((yield from x), math.e)
   |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | # see: https://github.com/astral-sh/ruff/issues/18639
   |
help: Replace with `math.log(yield from x)`
   |
52 | def log():
   -     yield math.log((yield from x), math.e)
53 +     yield math.log((yield from x))
54 |
   |

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
  --> FURB163.py:56:1
   |
55 |   # see: https://github.com/astral-sh/ruff/issues/18639
56 | / math.log(1, 10 # comment
57 | |          )
   | |__________^
58 |
59 |   math.log(1,
   |
help: Replace with `math.log10(1)`
   |
55 | # see: https://github.com/astral-sh/ruff/issues/18639
   - math.log(1, 10 # comment
   -          )
56 + math.log10(1)
57 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
  --> FURB163.py:59:1
   |
57 |            )
58 |
59 | / math.log(1,
60 | |          10 # comment
61 | |          )
   | |__________^
62 |
63 |   math.log(1 # comment
   |
help: Replace with `math.log10(1)`
   |
58 |
   - math.log(1,
   -          10 # comment
   -          )
59 + math.log10(1)
60 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
  --> FURB163.py:63:1
   |
61 |            )
62 |
63 | / math.log(1 # comment
64 | |          , # comment
65 | |          10 # comment
66 | |          )
   | |__________^
67 |
68 |   math.log(
   |
help: Replace with `math.log10(1)`
   |
62 |
   - math.log(1 # comment
   -          , # comment
   -          10 # comment
   -          )
63 + math.log10(1)
64 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(1)` over `math.log` with a redundant base
  --> FURB163.py:68:1
   |
66 |            )
67 |
68 | / math.log(
69 | |     1 # comment
70 | |     ,
71 | |     10 # comment
72 | | )
   | |_^
73 |
74 |   math.log(4.13e223, 2)
   |
help: Replace with `math.log10(1)`
   |
67 |
   - math.log(
   -     1 # comment
   -     ,
   -     10 # comment
   - )
68 + math.log10(1)
69 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log2(4.13e223)` over `math.log` with a redundant base
  --> FURB163.py:74:1
   |
72 | )
73 |
74 | math.log(4.13e223, 2)
   | ^^^^^^^^^^^^^^^^^^^^^
75 | math.log(4.14e223, 10)
   |
help: Replace with `math.log2(4.13e223)`
   |
73 |
   - math.log(4.13e223, 2)
74 + math.log2(4.13e223)
75 | math.log(4.14e223, 10)
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log10(4.14e223)` over `math.log` with a redundant base
  --> FURB163.py:75:1
   |
74 | math.log(4.13e223, 2)
75 | math.log(4.14e223, 10)
   | ^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `math.log10(4.14e223)`
   |
74 | math.log(4.13e223, 2)
   - math.log(4.14e223, 10)
75 + math.log10(4.14e223)
76 |
   |
note: This is an unsafe fix and may change runtime behavior

FURB163 [*] Prefer `math.log(*args)` over `math.log` with a redundant base
  --> FURB163.py:80:15
   |
78 | def print_log(*args):
79 |     try:
80 |         print(math.log(*args, math.e))
   |               ^^^^^^^^^^^^^^^^^^^^^^^
81 |     except TypeError as e:
82 |         print(repr(e))
   |
help: Replace with `math.log(*args)`
   |
79 |     try:
   -         print(math.log(*args, math.e))
80 +         print(math.log(*args))
81 |     except TypeError as e:
   |
note: This is an unsafe fix and may change runtime behavior
