Skip to content

Commit 4007cbd

Browse files
committed
Minor
1 parent 168f173 commit 4007cbd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

peps/pep-0824.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ string or collection literal, for others the default value could
6868
itself be a valid value, e.g. ``0``. Furthermore, custom types
6969
often do not have default values either. To denote the absence of
7070
a value, it is therefore common in Python to use the builtin sentinel
71-
``None``. Any code working with such functions either does some kind of
72-
validation to make sure a valid value is actual returned, maybe
71+
``None``. Most code working with such functions either does some kind
72+
of validation to make sure a valid value is actual returned, maybe
7373
returning early or rasing an exception if it is not, or provides
7474
a default / fallback value. To do this, it is common to use
7575
``is not None`` checks.
@@ -323,6 +323,7 @@ can eliminate unnecessary code.
323323
324324
@dataclass
325325
class User:
326+
# Not necessary to allow 'phone_numbers' to also be 'None' here
326327
phone_numbers: list[str] = field(default_factory=list)
327328
328329
def show_user_phone_numbers(user: User):
@@ -538,7 +539,7 @@ Use custom sentinels instead of ``None``
538539

539540
For Python 3.15 :pep:`661` added the option to define custom sentinels
540541
using ``sentinel(...)``. This addressed an issue in cases where ``None``
541-
itself is a valid value and thus could not be used as sentinel itself.
542+
itself is a valid value and thus could not be used as sentinel.
542543

543544
In general though, ``None`` will still be preferred if a sentinel is
544545
needed, simply because it already exists for that exact purpose and

0 commit comments

Comments
 (0)