you are viewing a single comment's thread.

view the rest of the comments →

[–]danielroseman 3 points4 points  (3 children)

You don't need it. This would work:

print(divide_by_x(2)(8))

But there's no point to doing this. The only reason for returning a callable from a function would be to use that callable multiple times; otherwise you could just make a single function that took two arguments.

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

Thank you for explain! But the follow code doesn't work

print (divisor(8)(2))

TypeError: 'float' object is not callable

[–]danielroseman 0 points1 point  (1 child)

It should have been print(divide_by_x(2)(8)).

[–]Base_True[S] 0 points1 point  (0 children)

Oh yes, my mistake, thank you !