Fix typos

This commit is contained in:
Joe Farebrother
2025-06-17 09:33:07 +01:00
parent 547c03cee6
commit d1bd7228c3
2 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ is mentioned in the documentation.
</recommendation>
<example>
<p>In the following case, the <code>__init__</code> method of <code>Super</code> calls the <code>set_up</code> method that is overridden by <code>Sub</code>.
This results in `Sun.set_up` being called with a partially initialized instance of `Super` which may be unexpected. </p>
This results in <code>Sub.set_up</code> being called with a partially initialized instance of <code>Super</code> which may be unexpected. </p>
<sample src="examples/InitCallsSubclassMethodBad.py" />
<p>In the following case, the initialization methods are separate between the superclass and the subclass.</p>
<sample src="examples/InitCallsSubclassMethodGood.py" />

View File

@@ -48,7 +48,7 @@ def good3():
class Super:
def __init__(self, arg):
self.a = arg
self.set_b() # OK: Here `set_b` is used for initialisation, but does not read the partialy initialized state of `self`.
self.set_b() # OK: Here `set_b` is used for initialization, but does not read the partially initialized state of `self`.
self.c = 1
def set_b(self):
@@ -63,7 +63,7 @@ def good4():
def __init__(self, arg):
self.a = arg
# OK: Here `_set_b` is likely an internal method (as indicated by the _ prefix).
# We assume thus that regular consumers of the library will not override it, and classes that do are internal and account for `self`'s partially initialised state.
# We assume thus that regular consumers of the library will not override it, and classes that do are internal and account for `self`'s partially initialized state.
self._set_b()
self.c = 1