Closed pmav99 closed 6 years ago
I agree. I'll accept a PR if you change the import to from . import _async
Thanks @RazerM, Just a note though, if we use explicit relative imports we need to convert the single module to a proper python package. E.g.:
$ tree ratelimiter
ratelimiter
├── _async.py
├── __init__.py
└── ratelimiter.py
Are you OK with that?
Yes, making this a package would be needed, otherwise you’d have to install two top-level modules e.g. ratelimiter and _ratelimiter_async, which is a bit inelegant.
(I would put the main code in ratelimiter/__init__.py
though, I don’t see why many projects have an empty __init__
and hide the code in a submodule that gets imported anyway)
Yes, a package should be used. The code can be in __init__.py
or core.py
if you'd prefer.
Not that
exec()
is a huge problem in this context, but perhaps a more elegant way to support Python < 3.5 would be to move__aenter__
into a different module and import the module on runtime. E.g.and