LEETAO_SPACE Telegram 1085
#每天读一篇技术文章

Don't return named tuples in new APIs

今天看到的一篇 Blog, 文章作者观点的不要在新的接口中使用 named tuples,可以在老的接口改造的时候替换原本的 tuples, 他觉得接口当函数名称足够清晰的前提下,返回 tuple 就够了,使用 named tuples 会增加复杂度,相较于 named tuples ,更推荐 dataclasses, dictionaries, TypedDict 等其他数据结构,我是不赞同这个观点的,作者的前提是建立在函数名清晰的前提下的,所以实际情况下,我觉得清晰的数据结构可能远比清晰的函数名来的更简单些,至于其他的数据结构的话,确实就像作者说的那样,使用 named tuples,测试用例你可能需要两个类别,毕竟 named tuples 访问数据的方式有两种



tgoop.com/leetao_space/1085
Create:
Last Update:

#每天读一篇技术文章

Don't return named tuples in new APIs

今天看到的一篇 Blog, 文章作者观点的不要在新的接口中使用 named tuples,可以在老的接口改造的时候替换原本的 tuples, 他觉得接口当函数名称足够清晰的前提下,返回 tuple 就够了,使用 named tuples 会增加复杂度,相较于 named tuples ,更推荐 dataclasses, dictionaries, TypedDict 等其他数据结构,我是不赞同这个观点的,作者的前提是建立在函数名清晰的前提下的,所以实际情况下,我觉得清晰的数据结构可能远比清晰的函数名来的更简单些,至于其他的数据结构的话,确实就像作者说的那样,使用 named tuples,测试用例你可能需要两个类别,毕竟 named tuples 访问数据的方式有两种

BY Leetao’s Space


Share with your friend now:
tgoop.com/leetao_space/1085

View MORE
Open in Telegram


Telegram News

Date: |

Telegram channels enable users to broadcast messages to multiple users simultaneously. Like on social media, users need to subscribe to your channel to get access to your content published by one or more administrators. Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up. fire bomb molotov November 18 Dylan Hollingsworth yau ma tei To delete a channel with over 1,000 subscribers, you need to contact user support Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots.
from us


Telegram Leetao’s Space
FROM American