numpython的设计选择

2024-04-25 22:15:57 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么python中的numpy的实现者决定为np.random.随机作为逗号分隔的整数,但用于np.零作为形状的元组? 请解释这个设计选择。 谢谢


Tags: numpynp整数random元组形状逗号
1条回答
网友
1楼 · 发布于 2024-04-25 22:15:57

NumPy包含一些方便的函数for users with a background from Matlab。因此NumPy将函数命名为与Matlab等效的函数,并使用 similar function call signature。你知道吗

根据the docs

[randn] is a convenience function. If you want an interface that takes a tuple as the first argument, use numpy.random.standard_normal instead.

^{}equivalent^{}但是使用 更多本机NumPy接口(使用size参数)。你知道吗

相关问题 更多 >

    热门问题