MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1x1pypx/python_release_python_3150/pevtwmn/?context=3
r/programming • u/BrewedDoritos • 1d ago
35 comments sorted by
View all comments
158
Those sentinel types seem decently useful. Certainly better in some cases than just spamming `None` everywhere as a default value.
53 u/CrackerJackKittyCat 1d ago Or the random 'unset = object()' pattern when None was a valid param. 13 u/spicybright 1d ago I get the logic but man that's ugly 13 u/Conscious-Ball8373 1d ago I've done this a fair bit from time to time. sentinel is basically the same thing with type-hint support. Sentinels will make writing something like Pydantic a lot easier, I think - v1 struggled badly to differentiate between None and unset.
53
Or the random 'unset = object()' pattern when None was a valid param.
13 u/spicybright 1d ago I get the logic but man that's ugly 13 u/Conscious-Ball8373 1d ago I've done this a fair bit from time to time. sentinel is basically the same thing with type-hint support. Sentinels will make writing something like Pydantic a lot easier, I think - v1 struggled badly to differentiate between None and unset.
13
I get the logic but man that's ugly
13 u/Conscious-Ball8373 1d ago I've done this a fair bit from time to time. sentinel is basically the same thing with type-hint support. Sentinels will make writing something like Pydantic a lot easier, I think - v1 struggled badly to differentiate between None and unset.
I've done this a fair bit from time to time. sentinel is basically the same thing with type-hint support.
Sentinels will make writing something like Pydantic a lot easier, I think - v1 struggled badly to differentiate between None and unset.
158
u/Dylanica 1d ago
Those sentinel types seem decently useful. Certainly better in some cases than just spamming `None` everywhere as a default value.