Incorrect expected output in decorator example
Author: berrylvzCreated Jul 26, 2026Updated Jul 27, 2026
In Chinese/14_higher_order_functions.md (around line 185), the expected output of the decorator example appears to be incorrect.
Current code:
@split_string_decorator
@uppercase_decorator # 在此情况下,装饰器的顺序很重要 - .upper()函数不适用于列表
def greeting():
return 'Welcome to Python'
print(greeting()) # WELCOME TO PYTHON
Since split_string_decorator calls split() on the uppercase string, greeting() returns a list rather than a string.
The expected output should be:
print(greeting()) # ['WELCOME', 'TO', 'PYTHON']
Source: Asabeneh/30-Days-Of-Python