Why are there no ordered dictionaries?
Ben Finney
bignose+hates-spam at benfinney.id.au
Mon Nov 21 00:34:39 EST 2005
bonono at gmail.com <bonono at gmail.com> wrote:
> [sort by] some other metadata that is not present in the data.
> [...]
> Of course, you may say, just put another column that represent
> this(some reporting programs I have seen do it this way) and that is
> an option but not the only option.
It's a pretty good option, and very commonly used. It's known as the
"Schwartzian transform", or more descriptively, the "Decorate, Sort,
Undecorate" pattern.
<URL:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52234>
--
\ "Experience is that marvelous thing that enables you to |
`\ recognize a mistake when you make it again." -- Franklin P. |
_o__) Jones |
Ben Finney
More information about the Python-list
mailing list