channels icon indicating copy to clipboard operation
channels copied to clipboard

channel layer Flush extension: rename close to aclose?

Open devkral opened this issue 2 years ago • 2 comments

I am not quite sure but it seems as there is a python convention to name an async close function "aclose". For example this name is used in contextlib.aclosing. A rename would ease to write tests or adapters for layers as we can simply reuse contextlib.aclosing.

Note: this is not a big issue. What aclosing does is easy to replicate with the close method (see python documentation).

devkral avatar Feb 09 '23 20:02 devkral

^What aclosing does is easy to replicate with a different named close method.

Modified example

from contextlib import asynccontextmanager

@asynccontextmanager
async def aclosing_modified(thing):
    try:
        yield thing
    finally:
        await thing.close()

devkral avatar Feb 14 '23 22:02 devkral

@devkral I haven't had a chance to really think about this yet, but it's on my list.

carltongibson avatar Feb 15 '23 10:02 carltongibson