19th November 2021
Coding⚑
Python⚑
asyncio⚑
-
New: Limit concurrency.
Use
asyncio.Semaphore.sem = asyncio.Semaphore(10) async with sem: # work with shared resource
Python Snippets⚑
-
New: Remove a substring from the end of a string.
On Python 3.9 and newer you can use the
removeprefixandremovesuffixmethods to remove an entire substring from either side of the string:url = 'abcdc.com' url.removesuffix('.com') # Returns 'abcdc' url.removeprefix('abcdc.') # Returns 'com'On Python 3.8 and older you can use
endswithand slicing:url = 'abcdc.com' if url.endswith('.com'): url = url[:-4]
Pydantic⚑
-
New: Field customization.
Optionally, the
Fieldfunction can be used to provide extra information about the field and validations. Such as thetitle,default,descriptionand many others
Tenacity⚑
- New: Introduce the Tenacity python library.