Menu

gitpiper

curry python Code Snippet in 2024

functionintermediate

Last Updated: 16 December 2024

Curries a function.

  • Use functools.partial() to return a new partial object which behaves like fn with the given arguments, args, partially applied.
from functools import partial def curry(fn, *args): return partial(fn, *args)
add = lambda x, y: x + y add10 = curry(add, 10) add10(20) # 30

python snippet similar to curry For You in December 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️