Re: What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
On Wednesday, November 5, 2014 2:00:08 PM UTC+8, Cameron Simpson wrote: > On 04Nov2014 19:17, Max Nathaniel Ho wrote: > >Just to be clear, I was referring to these two lines > > > >greet = compose_greet_func() > > > >greet_someone = greet > > Please don't top-post. Thanks. > > Your first assignm

Re: What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Cameron Simpson
On 04Nov2014 19:17, Max Nathaniel Ho wrote: Just to be clear, I was referring to these two lines greet = compose_greet_func() greet_someone = greet Please don't top-post. Thanks. Your first assignment: greet = compose_greet_func() _calls_ (runs) the compose_greet_func and assigns its re

Re: What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
Just to be clear, I was referring to these two lines greet = compose_greet_func() greet_someone = greet On Wednesday, November 5, 2014 11:15:46 AM UTC+8, Max Nathaniel Ho wrote: > Example 1 > > def compose_greet_func(): > def get_message(): > return "Hello there!" > > return

What is the difference between these two? (Assigning functions to variables)

2014-11-04 Thread Max Nathaniel Ho
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_