Steve Holden:
I forgot a detail: in the Python version of Odict I use element
deletion is O(n). You need a second dict to improve that (or a duble
linked list of hashing operations, see below).
> FYI there was a *long* discussion around the need for Speed sprint about
> implementing o
[EMAIL PROTECTED] wrote:
> I have found that in certain situations ordered dicts are useful. I use
> an Odict class written in Python by ROwen that I have improved and
> updated some for personal use.
>
> So I'm thinking about a possible C version of Odict (maybe fit for the
[EMAIL PROTECTED] wrote:
>> Then if you reinsert the deleted value it goes back in at its
>> original order.
>
> Uhm, this doesn't sound good. Thank you, I missed this detail :-)
> Then the doubly-linked list, and the links fixing seem necessary...
>
An alternative to a doubly linked list might
I have found that in certain situations ordered dicts are useful. I use
an Odict class written in Python by ROwen that I have improved and
updated some for personal use.
So I'm thinking about a possible C version of Odict (maybe fit for the
collections module).
On a 32 bit Win Pytho
Thank to Neil Cerutti and Duncan Booth for the answers. I have not
tried that C AVL implementation yet.
Duncan Booth:
> but for your ordered dictionary if you did that you would have
> to fix up the linked list.
To fix the list in constant time you probably need a doubly-linked
list, this requir
[EMAIL PROTECTED] wrote:
> Deleted keys from a dict/set aren't removed, they are tagged as
> deleted.
> My experience of CPython sources is tiny, I have just read few parts,
> so a person much more expert than me can comment the following lines.
>
> During the printing of the set/dict I think suc
On 2006-09-26, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have found that in certain situations ordered dicts are
> useful. I use an Odict class written in Python by ROwen that I
> have improved and updated some for personal use.
>
> So I'm thinking about a possible
Delaney, Timothy (Tim) wrote:
> Martin Miller wrote:
>
>
>>To avoid continued reinvention of this wheel, I'd also vote to have
>>this functionality be at least included in a standard module, if not
>>built-in.
>
>
> This has been discussed on python-dev (I proposed it actually). The
> final con
Martin Miller wrote:
> To avoid continued reinvention of this wheel, I'd also vote to have
> this functionality be at least included in a standard module, if not
> built-in.
This has been discussed on python-dev (I proposed it actually). The
final consensus was that no such implementation would b
More ways to do it, from the FAQ
http://www.python.org/doc/faq/programming.html#how-can-i-get-a-dictionary-to-display-its-keys-in-a-consistent-order
Also look at the recipe, page 222 of Cookbook2, that allows you to rank
key values by their associated values, and demonstrate the power of
mixins.
Simon Brunning wrote:
> On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote:
>
>>I have lots of code that looks like:
>>keys = mydict.keys()
>>keys.sort()
>
>
> keys = sorted(mydict.keys())
>
Or (often useful to get at contents):
items = sorted(mydict.items())
as in:
For k
[EMAIL PROTECTED] wrote:
> > Lots and lots of people want ordered dicts it seems. Or at least, they
> > want
> > to be able to access their dictionary keys in order.
> > [snipped lots of examples, nice pro-con lists, etc.]
> > What do y'all think?
>
> I
On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote:
> While the sorted() built in addressed (yet another) community desire, I
> don't think this addresses the underlying expectation of getting dictionary
> keys in some order.
You do get them in *some* order. ;-)
> It works, but it feel like a
On 10/08/05, Simon Brunning <[EMAIL PROTECTED]> wrote:
On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote:
> I have lots of code that looks like:> keys = mydict.keys()> keys.sort()keys = sorted(mydict.keys())
While the sorted() built in addressed (yet another) community desire, I don't th
On 8/10/05, Chris Cioffi <[EMAIL PROTECTED]> wrote:
> I have lots of code that looks like:
> keys = mydict.keys()
> keys.sort()
keys = sorted(mydict.keys())
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/pyt
> Lots and lots of people want ordered dicts it seems. Or at least, they
> want
> to be able to access their dictionary keys in order.
> [snipped lots of examples, nice pro-con lists, etc.]
> What do y'all think?
I'll second the need for this. Although, what can al
Lots and lots of people want ordered dicts it seems. Or at least, they want to be able to access their dictionary keys in order. It's in the FAQ (
http://www.python.org/doc/faq/programming.html#how-can-i-get-a-dictionary-to-display-its-keys-in-a-consistent-order) and has recently shown up
17 matches
Mail list logo