473,408 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Help on Dict

Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................

Feb 25 '07 #1
6 1323
Clement wrote:
Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................
I think it uses a dict.

James
Feb 25 '07 #2
Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................
Please see

http://svn.python.org/view/python/tr...82&view=markup

for general notes and

http://svn.python.org/view/python/tr...11&view=markup

for the actual implementation.

HTH,
Daniel
Feb 25 '07 #3
"James Stroud" <js*****@mbi.ucla.eduwrote:

Clement wrote:
Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................

I think it uses a dict.
"Groan!" - this answer is like Microsoft documentation -
while technically correct, it is useless... : - )

The key of a dict entry is subjected to a bit of magic called
a "Hashing algorithm" that yields a "bin" in which the data
is kept.

So to get hold of a dict entry always takes a similar time.

And its the quickest form of random access based on
a non integer key that you can get.

hth - Hendrik

Feb 26 '07 #4
On Mon, 26 Feb 2007 07:15:43 +0200, Hendrik van Rooyen wrote:
"James Stroud" <js*****@mbi.ucla.eduwrote:

>Clement wrote:
Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................

I think it uses a dict.

"Groan!" - this answer is like Microsoft documentation -
while technically correct, it is useless... : - )
Which I think was deliberate. The Original Poster asked a reasonable
question in a stupid way (Python is case-insensitive -- are we supposed
to guess what a Dict is? what language is 'plz'?), and I believe James
deliberately gave a stupid answer to highlight that.

class Dict(dict):
pass

is what I thought of when I saw the question. I guess James might have
thought the same way.

Unfortunately, more often than not, the sort of person who uses 'plz' in
an email probably isn't going to recognise the subtleties of James' reply.
--
Steven D'Aprano

Feb 26 '07 #5
On Mon, 26 Feb 2007 18:16:13 +0000, Dennis Lee Bieber wrote:
On Mon, 26 Feb 2007 17:58:34 +1100, Steven D'Aprano
<st***@REMOVEME.cybersource.com.audeclaimed the following in
comp.lang.python:
>>
Which I think was deliberate. The Original Poster asked a reasonable
question in a stupid way (Python is case-insensitive -- are we supposed
case-Sensitive

Gah!!!! Finger-fart. I was *thinking* _sensitive_, but my fingers typed
_insensitive_. I hate it when that happens.

--
Steven.

Feb 26 '07 #6
On Feb 26, 11:58 am, Steven D'Aprano
<s...@REMOVEME.cybersource.com.auwrote:
On Mon, 26 Feb 2007 07:15:43 +0200, Hendrik van Rooyen wrote:
"James Stroud" <jstr...@mbi.ucla.eduwrote:
Clement wrote:
Can any body tell how Dict is implemented in python... plz tell what
datastructure that uses................
I think it uses a dict.
"Groan!" - this answer is like Microsoft documentation -
while technically correct, it is useless... : - )

Which I think was deliberate. The Original Poster asked a reasonable
question in a stupid way (Python is case-insensitive -- are we supposed
to guess what a Dict is? what language is 'plz'?), and I believe James
deliberately gave a stupid answer to highlight that.

class Dict(dict):
pass

is what I thought of when I saw the question. I guess James might have
thought the same way.

Unfortunately, more often than not, the sort of person who uses 'plz' in
an email probably isn't going to recognise the subtleties of James' reply.

--
Steven D'Aprano
ada koothingala

Mar 10 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kim Petersen | last post by:
I've worked on this table object a bit too long - and seem to have stared too long at the code. Can someone see where it goes wrong in the insertrow function? Also optimization hints and...
1
by: ±è»ó¿Ï | last post by:
I'm a newbie in Python and Python/C API.. I have a simple question. I want to access python dictionary data type from C extension module. ---- spam.c ---- #include <Python.h> PyObject...
21
by: gargonx | last post by:
would anyone like to help to fugure out this problem i'm having here's a portion of my code: """ I have three dictionaries along with this(you can probally spot what they are), but just in case...
2
by: icedgar | last post by:
I currently have the following XML: <AAA> <dict> <a>apple</a> <dict> <a>2</a> <dict> <a>James</a> <x>1</x>
6
by: Charlie | last post by:
Dear all, I am stuck on this problem, couldn't find an answer on any C++ book in the bookshop. Following is a cut of my program, and its error message:...
4
by: Mingus Tsai | last post by:
Hello- please help with unpickling problem: I am using Python version 2.3.4 with IDLE version 1.0.3 on a Windows XPhome system. My problem is with using cPickle to deserialize my pickled...
8
by: rh0dium | last post by:
Hi all, I have a dict which looks like this.. dict={'130nm': {'umc': }, '180nm': {'chartered': , 'tsmc': }, '250nm': {'umc': , 'tsmc': } }
15
by: George Sakkis | last post by:
Although I consider dict(**kwds) as one of the few unfortunate design choices in python since it prevents the future addition of useful keyword arguments (e.g a default value or an orderby...
3
by: aking | last post by:
Dear Python people, im a newbie to python and here...so hello! Im trying to iterate through values in a dictionary so i can find the closest value and then extract the key for that...
23
by: special_dragonfly | last post by:
Hello, I'm new to this group, I've read through the subject of a lot of the group but can't find anything relevant. Perhaps my question is too basic but I'm still stuck. Classes and Dictionaries....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.