# 透過decorator重複使用calculate裝飾器,可用print出不同語言的敘述 @calculate_decorator defen_calculate(result_from_calculate_decorator): print("The result for calculating 1 to 10 is ", result_from_calculate_decorator)
@calculate_decorator defch_calculate(result_from_calculate_decorator): print("計算1 to 10 是 ", result_from_calculate_decorator)
en_calculate()
執行結果
1 2
The result for calculating 1 to 10 is 45 計算1 to 10 是 45
# 透過decorator重複使用calculate裝飾器,可用print出不同語言的敘述 @define_number_for_calculator_decorator(50) defen_calculate(result_from_calculate_decorator): print("The result for calculating 1 to 50 is ", result_from_calculate_decorator)
@define_number_for_calculator_decorator(50) defch_calculate(result_from_calculate_decorator): print("計算1 to 50 是 ", result_from_calculate_decorator)
@dsl.pipeline( name='calculation-pipeline', description='A toy pipeline that performs arithmetic calculations.' ) def calc_pipeline( a=7, b=8, c=17, ): #Passing pipeline parameter and a constant value as operation arguments add_task = add_op(a, 4) #Returns a dsl.ContainerOp class instance. #Passing a task output reference as operation arguments #For an operation with a single return value, the output reference can be accessed using `task.output` or `task.outputs['output_name']` syntax divmod_task = divmod_op(add_task.output, b)
#For an operation with a multiple return values, the output references can be accessed using `task.outputs['output_name']` syntax result_task = add_op(divmod_task.outputs['quotient'], c)