Skip to content

Incorrect expected output in decorator example #920

Description

@berrylvz

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']

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions