#umask — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #umask, aggregated by home.social.
-
Encapsulating the atrocity of umask handling with Python's walrus operator:
os.umask(current_umask := os.umask(0))
This isn't clearly *better*, but at least it's clearly shorter. Without `:=`, we'd need two lines:
current_umask = os.umask(0)
os.umask(current_umask)Note: The awkwardness is a necessary consequence of how POSIX handles umask. Also, neither version is threadsafe.