Skip to content

Commit 9ed7bb4

Browse files
Update duck_type_compatibility.rst: mention strict-bytes & mypy 2.0 (#20121)
Seems like a good idea to mention this, while we're on the subject.
1 parent bed188f commit 9ed7bb4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/source/duck_type_compatibility.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ supported for a small set of built-in types:
99
* ``int`` is duck type compatible with ``float`` and ``complex``.
1010
* ``float`` is duck type compatible with ``complex``.
1111
* ``bytearray`` and ``memoryview`` are duck type compatible with ``bytes``.
12+
(this will be disabled by default in **mypy 2.0**, and currently can be
13+
disabled with :option:`--strict-bytes <mypy --strict-bytes>`.)
1214

1315
For example, mypy considers an ``int`` object to be valid whenever a
1416
``float`` object is expected. Thus code like this is nice and clean

0 commit comments

Comments
 (0)