Order of keyword arguments
Gordon McMillan
gmcm at hypernet.com
Sun Nov 21 14:17:16 EST 1999
Andres Corrada wrote:
> Gordon McMillan wrote:
> >
> > Ah, but that would be "alphabetical order", not "entry order",
> > and not much use to anybody if it were.
> >
>
> I disagree. I think you are confusing entry order with type of
> ordering. entry order could be alphabetical but it could also be
> by time of entry, for example. My point still stands: an ordered
> dictionary would be a useful data structure to have.
Well I'm feeling amiably disagreeable too, so I'll differ with that.
A "dictionary" in the wider-than-Python sense has an ordering
to it that is based on it's keys. The order of arguments to a
function is _not_ an ordering based on the argument names;
ergo, the existence of an American Heritage Dictionary gets
you no closer to your goal (in this sense, at least). What
you're apparently arguing for is an ordered dictionary. What
you _want_ is an indexed list.
> > Python data structures that would suit your apparent desires:
> > [ (optionname, optionvalue), ... ]
>
> Mike Fletcher suggested this also and it is the way I'm getting
> to eat my cake and have it too :-)
bon-apetit-ly y'rs
- Gordon
More information about the Python-list
mailing list