Apply a function to each list member?

Malcolm Tredinnick malcolmt at smart.net.au
Fri Nov 5 11:55:04 CET 1999


On Fri, Nov 05, 1999 at 11:06:17AM +0200, Mikael Olofsson wrote:
> I guess the terminology originally is taken from mathematics. A map is 
> a mathematical concept, similar to a function. Perhaps you should say
> that a function is a map, rather than the other way around.

Correct. In fact, since we're being precise, let me point out that
(mathematically speaking), all functions are maps (or mappings), but not
all mappings are functions. The point is that a function should have only a
single "output" for any given input (i.e. it should be many-to-one or
one-to-one, not one-to-many). So some mapping that sends, say, the number 2
to the numbers 3 and 4 is not a function (but a mapping that sends both the
numbers 3 and 4 to the number 2 is a function, since for each input there
is only a single output).

(Hmm .. I've just realised that a few of my recent postings have had
amazingly little to do with Python. I promise to stick to the topic from
now one. Swear! :-) )

Cheers,
Malcolm Tredinnick





More information about the Python-list mailing list