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

Max Nathaniel Ho maxhowl86 at gmail.com
Wed Nov 5 02:33:34 EST 2014


On Wednesday, November 5, 2014 2:00:08 PM UTC+8, Cameron Simpson wrote:
> On 04Nov2014 19:17, Max Nathaniel Ho <maxhowl86 at gmail.com> 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 return value to greet.
> 
> Your second assignment:
> 
>    greet_someone = greet
> 
> assigns the current value of "greet", whatever that is, to "greet_someone". No 
> function is called.
> 
> Cheers,
> Cameron Simpson <cs at zip.com.au>

Apologies about the top posting.

Ahh okay, thank you for your explanation



More information about the Python-list mailing list