hey guys i am having trouble understanding this, i dont get when themap is referenced to the cities dict really. or the last line, what is the(cities, state) part?
t
cities['_find']
is exactly find_city
. So cities['_find'](cities, state)
is the same as find_city(cities, state)
.
The reason for my first statement is this line:
cities['_find'] = find_city
That doesn't call find_city
, it sticks the function itself in the dictionary. Python functions are just objects like lists and class instances. If you don't put parentheses after them, they can be assigned to variables.