Skip to content

Commit 28034cc

Browse files
authored
[mypyc] Small documentation updates (#10184)
Here are a few updates/fixes after a read through the mypyc docs. For the corresponding primitive method updates, see: * str.replace: #10088 * dict.copy: #9721 * dict.clear: #9724
1 parent 4adb5e4 commit 28034cc

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ __pycache__
66
/env*/
77
docs/build/
88
docs/source/_build
9+
mypyc/doc/_build
910
*.iml
1011
/out/
1112
.venv*/

mypyc/doc/dict_operations.rst

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Methods
4343
* ``d.keys()``
4444
* ``d.values()``
4545
* ``d.items()``
46+
* ``d.copy()``
47+
* ``d.clear()``
4648
* ``d1.update(d2: dict)``
4749
* ``d.update(x: Iterable)``
4850

mypyc/doc/native_classes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ can be assigned to (similar to using ``__slots__``)::
3838
def method(self) -> None:
3939
self.z = "x"
4040

41-
o = Cls()
41+
o = Cls(0)
4242
print(o.x, o.y) # OK
4343
o.z = "y" # OK
4444
o.extra = 3 # Error: no attribute "extra"
@@ -90,7 +90,7 @@ You need to install ``mypy-extensions`` to use ``@mypyc_attr``:
9090
Class variables
9191
---------------
9292

93-
Class variables much be explicitly declared using ``attr: ClassVar``
93+
Class variables must be explicitly declared using ``attr: ClassVar``
9494
or ``attr: ClassVar[<type>]``. You can't assign to a class variable
9595
through an instance. Example::
9696

mypyc/doc/str_operations.rst

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Methods
2727

2828
* ``s1.endswith(s2: str)``
2929
* ``s.join(x: Iterable)``
30+
* ``s.replace(old: str, new: str)``
31+
* ``s.replace(old: str, new: str, count: int)``
3032
* ``s.split()``
3133
* ``s.split(sep: str)``
3234
* ``s.split(sep: str, maxsplit: int)``

0 commit comments

Comments
 (0)