[Tutor] how to unittest cli input

Danny Yoo dyoo at hashcollision.org
Wed Oct 14 01:06:27 CEST 2015


On Tue, Oct 13, 2015 at 2:44 PM, Alex Kleider <akleider at sonic.net> wrote:
> On 2015-10-13 12:11, Danny Yoo wrote:
>
>
>> ######################
>> def make_ask(f, l, p):
>>     d = {'Enter your first name: ' : f,
>>            'Enter your last name: ' : l,
>>            'Your mobile phone #: ' : p}
>>     return d.get
>> ######################
>
>
> This last line got my attention ("a dict has no such attribute"
> but rather "it has a 'get' method")
> but then the light went on: you've created a function that
> returns a function. So many levels of abstraction!


Yes.  Functions are cool.  To use of functions as first-class values
is a lot of fun, and you'll get the hang of it once you see the trick
a few times.


More information about the Tutor mailing list