Hashtables in pyhton ...

  • Thread starter =?ISO-8859-1?Q?Konrad_M=FChler?=
  • Start date
?

=?ISO-8859-1?Q?Konrad_M=FChler?=

Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks
 
M

Max M

Konrad said:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?
>>> a_hash_is_a_dict = {'key':'value'}
>>> a_hash_is_a_dict['key2'] = 'value 2'
>>> a_hash_is_a_dict['key']
'value'

--

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science

Phone: +45 66 11 84 94
Mobile: +45 29 93 42 96
 
L

Larry Bates

Konrad said:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks

Take a look at a python dictionary. keys in dictionaries are hashed and
lookups are very efficient.

-Larry Bates
 
X

Xavier Morel

Konrad said:
Hi,

are there predefinded chances to use hashtables in python? How can I use
Hashtable in python? Or do I have to implement this on my own?

Thanks
A Java Hashtable/Hashmap is equivalent to a Python dictionary, which is
a builtin objects (and not a second-class citizen in some distant, dark,
cold library full of Evil Things ©). You can access it either via the
regular constructor `dict()` or via the syntaxical shorcut

{ key1: val1, key2: val2, key3: val3}
 
R

Ravi Teja

Hashtables (dictonaries) and ArrayLists(lists) are integral parts of
modern languages (for example: Python, Ruby, OCaml, D). They are
builtin data types unlike say, Java or C++, where they are added to the
library as an afterthought.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,585
Members
45,081
Latest member
AnyaMerry

Latest Threads

Top