Hey,你好,欢迎来到 Python 随身听周一的《全球技术精选》。
这一次 DE8UG 给你带来的是:
- 四款新的值得关注的代码库
- 两款需要长期持有的代码库
四款新的值得关注的代码库
Typical: Fast, simple, & correct data-validation using Python 3 typing.
直接通过装饰器@typic.al,然后自动根据 Python3 的注解功能自动判断输入参数类型。
更多查看:https://github.com/seandstewart/typical/
示例:
>>> import typic
>>>
>>> @typic.al
>>> def multi(a: int, b: int):
... return a * b
...
>>> multi('2', '3')
6
>>> class DuckRegistry:
... """A Registry for all the ducks"""
...
... @typic.al
... def __init__(self, *duck: Duck):
... self._reg = {
x.name