3 ms·
Could this be used without the "bp."? Half the point of coming up with a nicer notation is for the notation to actually be nicer.
by civilized 5y ago
Could this be used without the "bp."? Half the point of coming up with a nicer notation is for the notation to actually be nicer.
- mrtranscendence 5y agoWell, you could do from better_partial import partial, _ presumably. Though since _ has some meaning in Python maybe you'd want to do from better_partial import partial, _ as x instead (or something like it).
- cgrimm1994 5y agoAs pointed out, you could import _ directly into your namespace, or map it to some other shorthand name that doesn't interfere with your naming conventions. Also note that the _ placeholder isn't the only way that better_partial helps you. You can also use ... to indicate that you want to omit all arguments except ones you explicitly pass as kwargs. For instance: from better_partial import partial, _ @partial def f(a,b,c,d,e): return (a,b,c,d,e) f(_,_,3,_,_)(1,2,4,5) == f(..., c=3)(1,2,4,5)