toad.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server operated by David Troy, a tech pioneer and investigative journalist addressing threats to democracy. Thoughtful participation and discussion welcome.

Administered by:

Server stats:

218
active users

#contextmanager

0 posts0 participants0 posts today
scy<p>Python context managers are a really nice way to ensure you're cleaning up after yourself.</p><p>Here I'm using <a href="https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">docs.python.org/3/library/cont</span><span class="invisible">extlib.html#contextlib.contextmanager</span></a> to make sure that every mounted directory gets unmounted at the end of the `with` block, even if there are exceptions somewhere along the way.</p><p>(Usually a context manager would yield some kind of resource. For these, it doesn't make sense, so they just have empty `yield` statements.)</p><p><a href="https://chaos.social/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://chaos.social/tags/contextlib" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>contextlib</span></a> <a href="https://chaos.social/tags/contextmanager" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>contextmanager</span></a> <a href="https://chaos.social/tags/mount" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mount</span></a></p>