|
|
|
|
|
by zahlman
160 days ago
|
|
> this rings alarm bells for me reading that a cleanup_c(c) has maybe been forgotten somewhere, since the happy and unhappy paths clean up different amounts of things. The exact point of taking the main work to a separate function is so that you can see all the paths right there. Of course there is no `c` to worry about; the wrapper is so short that it doesn't have room for that to have happened. The Python code doesn't have to deal with stuff like this because it has higher-level constructs like context managers, and because there's garbage collection. def get_resources_and_do(action):
with get_a() as a, get_b() as b:
action(a, b)
|
|