@@ -68,8 +68,8 @@ string or collection literal, for others the default value could
6868itself be a valid value, e.g. ``0 ``. Furthermore, custom types
6969often do not have default values either. To denote the absence of
7070a 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
7373returning early or rasing an exception if it is not, or provides
7474a 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
539540For Python 3.15 :pep: `661 ` added the option to define custom sentinels
540541using ``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
543544In general though, ``None `` will still be preferred if a sentinel is
544545needed, simply because it already exists for that exact purpose and
0 commit comments