Express What, not How.
Raffael Cavallaro
raffaelcavallaro at junk.mail.me.not.mac.com
Fri Oct 17 08:03:49 EDT 2003
In article <3f8e1312 at news.sentex.net>,
hs at heaven.nirvananet (Hartmann Schaffer) wrote:
> map is an abstraction that
> specifies that you want to apply a certain operation to each element
> of a collection, with adding the offset being the desired operation.
Sorry to reply so late - I didn't see this post.
In the context in which the offsets are added, it isn't necessary to
know that the offsets are added using map, as opposed, for example, to
an interative construct, such as loop. Since we don't need to know _how_
the adding of offsets is done at every location in the source where we
might want to add an offset to the elements of a list or vector, we
should _name_ this bit of functionality. This is an even bigger win
should we ever decide to switch from map to loop, or do, or dolist, etc.
Then we write a single change, not one for every time we use this bit of
functionality.
More information about the Python-list
mailing list