[Tutor] Python Hard_way 40

bob gailer bgailer at gmail.com
Wed May 11 17:39:14 CEST 2011


On 5/11/2011 11:24 AM, Robert . wrote:
> Hi all,
>
> My first post ever! :)
> I'm following the guide "Learn Python the Hard Way" and have reached a 
> point where I am struggling to understand the code and unfortunately 
> the authors guide hasn't cleared it up for me. (excercise 40 for 
> reference)
>
> The main confusion is coming from*'cities['_find'] = find_city'* I'm 
> not sure what this is really doing.
>
> From my learning, this should add an extra item to the dict with the 
> index name of "_find" and the value which is returned from "find_city" 
> function.

This stores a reference to the function. The following line is the call 
to the function.

city_found = cities['_find'](cities,state)

[snip]

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110511/14600f14/attachment.html>


More information about the Tutor mailing list