Glyph on Nostr: If you've got a context manager, like so: with foo() as bar: ... What is the word, ...
If you've got a context manager, like so:
with foo() as bar:
...
What is the word, ideally the verb, that describes the relationship between `foo` and `bar`? It's not quite accurate to say `foo` *returns* `bar`, since `foo` returns a context manager that… somethings… `bar`. It doesn't *yield* `bar` either; if yield is involved, it's an implementation detail in contextlib. In app-developer docs saying "Returns a context manager whose __enter__ method which returns …" is tedious. #python
Published at
2024-06-20 21:49:07Event JSON
{
"id": "b2b99509aa45e70149723059036396be429bed5d4cffff734a8b78ce773be527",
"pubkey": "bd385aa0b579765c6883c5b0eb17e8ae350c988c659510be1e8453557ee38784",
"created_at": 1718920147,
"kind": 1,
"tags": [
[
"t",
"python"
],
[
"proxy",
"https://mastodon.social/users/glyph/statuses/112651150808355206",
"activitypub"
]
],
"content": "If you've got a context manager, like so:\n\n with foo() as bar:\n ...\n\nWhat is the word, ideally the verb, that describes the relationship between `foo` and `bar`? It's not quite accurate to say `foo` *returns* `bar`, since `foo` returns a context manager that… somethings… `bar`. It doesn't *yield* `bar` either; if yield is involved, it's an implementation detail in contextlib. In app-developer docs saying \"Returns a context manager whose __enter__ method which returns …\" is tedious. #python",
"sig": "901b070366a70720c875836956dfbd4b1670bbf6a4ee2bc6e8376efe789ae4cabc6d8799f3a35b45c6683f8456b97d3c1a325a522c80552f9596021353fa67ae"
}