Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Shashwat Anand
On Thu, Aug 19, 2010 at 10:31 AM, Sahasranaman MS sah...@naman.ms wrote: On Thursday 19 August 2010 07:08 AM, Kenneth Gonsalves wrote: On Wed, 2010-08-18 at 10:28 -0700, Anand Shankar wrote: I have no clues. Any inputs?? sort order of dictionary keys is not guaranteed. Only a list will

Re: [BangPypers] NLTK: Dispersion Plot problem

2010-08-19 Thread Gaurav Kalra
gvka...@gvkalra-laptop:~$ cd Desktop/srv/python-environments/ gvka...@gvkalra-laptop:~/Desktop/srv/python-environments$ source gotcha/bin/activate (gotcha)gvka...@gvkalra-laptop:~/Desktop/srv/python-environments$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Jeffrey Jose
On Thu, Aug 19, 2010 at 10:31 AM, Sahasranaman MS sah...@naman.ms wrote: On Thursday 19 August 2010 07:08 AM, Kenneth Gonsalves wrote: On Wed, 2010-08-18 at 10:28 -0700, Anand Shankar wrote: I have no clues. Any inputs?? sort order of dictionary keys is not guaranteed. Only a list will

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Anand Shankar
Thanks a Ton to all. I got a mucher deeper insight than my question deserved!!! Thanks once again anand ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Dipo Elegbede
Hi All, There really shouldn't be so much debate on the question asked. Someone actually gave a direct and clear answer. I'm new at python and his explanations were quite understandable. As far as dictionaries are concerned, when you retrieve keys, there is no guarantee of a particular order. If

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Praveen Kumar
Here is a small script to sort the dictionary based on key/choice a = {key3: 5 , key2: 8, key1: 2} b = {key2: 7 , key1: 4, key3: 9} c = {key1: 6 , key3: 1, key2: 1} undecorated = [a, b, c] # how do you sort this list? sort_on = key3 decorated = [(dict_[sort_on], dict_) for dict_ in [b]]

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Jeffrey Jose
On Thu, Aug 19, 2010 at 10:26 AM, Dipo Elegbede delegb...@dudupay.comwrote: Hi All, There really shouldn't be so much debate on the question asked. Someone actually gave a direct and clear answer. I'm new at python and his explanations were quite understandable. I'm sorry that you sensed a

Re: [BangPypers] Dictionary : An elementary question

2010-08-19 Thread Dhananjay Nene
Lots of good answers. Warning: *this answer is ultra simplistic one to explain the implementation succinctly*. A little more from an implementation perspective dict operations usually involve converting a dict into a hash. This hash is then converted into a bucket. And sometimes when one gets