Jun-03-2019, 01:13 AM
(This post was last modified: Jun-03-2019, 01:14 AM by ichabod801.)
So, say you are passing around callables to functions. Say also that you could do this with something from the operator package. Would you create a lambda to do it, or use operator?
For example, I have this function specification:
But I was thinking of rewriting it this way:
Do you have a preference? Any particular reason for that preference?
For example, I have this function specification:
1 |
def ask_valid( self , prompt, valid, default = '', conversion = lambda choice: choice.lower()): |
1 |
def ask_valid( self , prompt, valid, default = ' ', conversion = operator.methodcaller(' lower')): |
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures