【发布时间】:2026-02-25 06:00:02
【问题描述】:
def a(something):
return something*something
#Case I - referencing
b = a
#Case II - creating a new function to call the first
def b(something):
return a(something)
哪种风格更好?两者都有缺点吗?
【问题讨论】:
-
你为什么要做这些,而不是仅仅通过它的名字来引用?
-
我正在制作一种插件类型的东西,其中每个模块都需要实现某个模块,但可能会使用适用于大多数情况的预制模块。
标签: python function coding-style