Hashtables in pyhton ...

Discussion in 'Python' started by =?ISO-8859-1?Q?Konrad_M=FChler?=, Mar 9, 2006.

  1. 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
    =?ISO-8859-1?Q?Konrad_M=FChler?=, Mar 9, 2006
    #1
    1. Advertising

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

    Max M Guest

    Konrad Mühler wrote:
    > 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
    Max M, Mar 9, 2006
    #2
    1. Advertising

  3. Fredrik Lundh, Mar 9, 2006
    #3
  4. =?ISO-8859-1?Q?Konrad_M=FChler?=

    Larry Bates Guest

    Konrad Mühler wrote:
    > 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
    Larry Bates, Mar 9, 2006
    #4
  5. =?ISO-8859-1?Q?Konrad_M=FChler?=

    Xavier Morel Guest

    Konrad Mühler wrote:
    > 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}
    Xavier Morel, Mar 9, 2006
    #5
  6. =?ISO-8859-1?Q?Konrad_M=FChler?=

    Ravi Teja Guest

    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.
    Ravi Teja, Mar 9, 2006
    #6
  7. Max M wrote:
    > >>> a_hash_is_a_dict = {'key':'value'}
    > >>> a_hash_is_a_dict['key2'] = 'value 2'
    > >>> a_hash_is_a_dict['key']

    > 'value'


    Thank you very much.
    This is I was looking for :)
    =?ISO-8859-1?Q?Konrad_M=FChler?=, Mar 10, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Sweetman

    Manipulating HashTables

    Andrew Sweetman, Aug 22, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,195
    Steve C. Orr, MCSD
    Aug 22, 2003
  2. =?Utf-8?B?U3VuZGFyYXJhamFu?=

    Caching Hashtables

    =?Utf-8?B?U3VuZGFyYXJhamFu?=, Jul 24, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    648
    Yunus Emre ALPÖZEN [MCSD.NET]
    Jul 30, 2005
  3. Replies:
    1
    Views:
    506
    Karl Seguin
    Oct 17, 2005
  4. J.Eddy

    Java Hashtables

    J.Eddy, Jul 16, 2003, in forum: Java
    Replies:
    3
    Views:
    482
    Roedy Green
    Jul 17, 2003
  5. Replies:
    2
    Views:
    346
Loading...

Share This Page