Help on Dict

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Clement

    #1

    Help on Dict

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

  • James Stroud

    #2
    Re: Help on Dict

    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

    Comment

    • Daniel Nogradi

      #3
      Re: Help on Dict

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



      for general notes and



      for the actual implementation.

      HTH,
      Daniel

      Comment

      • Hendrik van Rooyen

        #4
        Re: Help on Dict

        "James Stroud" <jstroud@mbi.uc la.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

        Comment

        • Steven D'Aprano

          #5
          Re: Help on Dict

          On Mon, 26 Feb 2007 07:15:43 +0200, Hendrik van Rooyen wrote:
          "James Stroud" <jstroud@mbi.uc la.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

          Comment

          • Steven D'Aprano

            #6
            Re: Help on Dict

            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
            <steve@REMOVEME .cybersource.co m.audeclaimed the following in
            comp.lang.pytho n:
            >
            >>
            >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.

            Comment

            • Clement

              #7
              Re: Help on Dict

              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.uc la.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

              Comment

              Working...