Example 1
def compose_greet_func():
def get_message():
return "Hello there!"
return get_message
greet = compose_greet_func()
print greet()
Example 2
def greet(name):
return "hello "+name
greet_someone = greet
print greet_someone("John"
In Example 1, the function compoe_greet_func is assigned to the variable greet,
and () is included at the end of the function.
However, in Example 2, the function greet is assigned to the variable
greet_someone but () is excluded at the end of the function.
Does the () matter when assigning functions to variables?
Thank you!
--
https://mail.python.org/mailman/listinfo/python-list