[Tutor] data driven programming
akleider at sonic.net
Sat Apr 5 00:45:32 CEST 2014
On 2014-04-04 01:51, Alan Gauld wrote:
> On 04/04/14 03:33, Alex Kleider wrote:
>>> And to some extent Python is an example of a data driven
>>> design since function (and method) calls are associated with
>>> dictionaries (ie Python namespaces).
>> Can you elaborate, please, on what you mean by pointing out that the
>> fact that Python's function and method calls are associated with
>> dictionaries makes it 'an example of data driven design?' I'm not
>> on that relationship. Thanks, Alex
> Most of Python is built on dictionaries under the surface.
> When you define a function you create a function object
> and associate it with a name. In other words you store
> the name as a key in a dictionary and have the function
> object as the value.
> When you call the function Python looks up the name in
> the dictionary and calls the associated object.
> This is very similar to what was recommended to you
> to avoid the long list of if/elif.
Thank you. I thought there was something more. ak
More information about the Tutor