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 clear
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.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to