函数的decorator,用于简单地调整布尔参数
magwitch的Python项目详细描述
#魔法开关!
`` python
导入magwitch
@magwitch.on
def save_figure(in_png:bool=false,legend:bool=true):
…#我们不关心示例
return in_png
您可以多次执行此操作:
保存“figure.not_in_png.no_legend()
@magwitch.on_with(use_defaults=true,enable=-do_,disable=('nope_,'never_'):
def f(a:bool=false):返回a
以及“magwitch.build”的文档字符串,用于描述所有可用参数。
函数 in 参数 png on def decorator figure bool
`` python
导入magwitch
@magwitch.on
def save_figure(in_png:bool=false,legend:bool=true):
…#我们不关心示例
return in_png
您可以多次执行此操作:
保存“figure.not_in_png.no_legend()
@magwitch.on_with(use_defaults=true,enable=-do_,disable=('nope_,'never_'):
def f(a:bool=false):返回a
以及“magwitch.build”的文档字符串,用于描述所有可用参数。
标签: