Sentinel built-in 0 ▲ mathspp.com feed 3 hours ago · Tech · hide · 0 comments Learn how to use the sentinel built-in from Python 3.15 for placeholder values. Python 3.15 introduced the new sentinel built-in. The sentinel built-in can be used to create placeholder values: NOTHING = sentinel("NOTHING") A placeholder created by sentinel is the more idiomatic way to provide default arguments or return values where None wouldn't be usable. 15 days of Python 3.15 To celebrate the release of Python 3.15, over the next 15 business days I'll be writing about a new 3.15 feature every day. Explained clearly and with examples so you don't have to sift through the changelog. Subscribe to receive this free email series: Enroll for free 🐍🚀 If you want, you can also check the schedule of the upcoming emails. Creating and using sentinels The built-in sentinel accepts a string argument which is the name of the sentinel: NOTHING = sentinel("NOTHING") print(NOTHING) # NOTHING The name of the sentinel is used as its default string representation. Alternatively, you can provide a… No comments yet. Log in to reply on the Fediverse. Comments will appear here.