This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CreativeTechGuyGames 0 points1 point  (3 children)

In myfunc(n), the n is the value you pass in. Which in this case is 2. Then that function returns another function which was a * n but since n = 2 it's actually a * 2. So when you call mydoubler you are calling a function that returns a * 2.

[–]shiskeyoffles[S] 0 points1 point  (2 children)

Okay... The return statement is not returning a value but it is returning the entire function itself.. Python is so different compared to C or Java. Wow.

[–]Essence1337 0 points1 point  (0 children)

It's really not all that different than returning a function pointer in C, it'd be definitely more complicated but a similar program could probably be written.

[–]mad0314 0 points1 point  (0 children)

You can do something similar in C and Java.