[BangPypers] Reorder Dictionary Size in python

Rahul R rahul8590 at gmail.com
Wed Apr 17 17:52:30 CEST 2013


Ahh , sorry If i wasnt clear the first time. I dint mean reorder the data
in dictionary. I meant resize the dictionary.

./Rahul

On Wed, Apr 17, 2013 at 9:05 PM, Anand Chitipothu <anandology at gmail.com>wrote:

> dictionaries are unordered. It is not a good idea to expect any order in
> dictionaries, even if you are seeing some order by chance.
>
> If you need order, then use OrderedDict from collections module (new in
> Python 2.7).
>
> Anand
>
>
> On Wed, Apr 17, 2013 at 9:00 PM, Rahul R <rahul8590 at gmail.com> wrote:
>
> > Hey  Guys,
> >
> > Is it possible to forcibly reorder the python dictionary after "n" number
> > of inserts and deletions. As far as i know, python dictionary performs
> lazy
> > deletes. Thus , even if the data is deleted, python has a dummy data
> their
> > in order to preserve consistency. The python dictionary
> > keeps expanding when the size of dict is increasing, but after deleting a
> > few parameters the size does not decrease. Is there a way , where I can
> > forcibly resize the dictionary ?
> >
> > I was thinking of copying content from existing dictionary to new dict
> and
> > deleting the previous one.But thats a cumbersome operation.
> >
> > Thanks,
> > ./Rahul
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
> Anand
> http://anandology.com/
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list