Why I think range is a wart.

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Fri Mar 15 19:27:24 EST 2002


In article <a6qjeq$fvcf8$1 at ID-135695.news.dfncis.de>, Bertrand Geston wrote:
[...]
>Let's keep things simple and understandable :
>- lists are ordered sets,
>- dictionnaries are "keyed" sets.

The standard mathematical definition of sequences (as opposed to
ordered sets) is a partial function mapping integers to elements. This
seems awfully close to what you're calling "keyed" sets, by
restricting the domain to integers. It also seems awfully close to
Python lists (for instance). I see nothing inconsistent or illogical
about list.keys. list.indices is an alternative, of course, but would
not allow for polymorphic use.

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list