User Profile

Collapse

Profile Sidebar

Collapse
brainstaurm
brainstaurm
Last Activity: Aug 13 '07, 07:33 PM
Joined: May 7 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • brainstaurm
    started a topic Pickle __reduce__

    Pickle __reduce__

    The Python reference provides some explanation of how __reduce__ works (see http://docs.python.org/lib/node321.html) . I have read this page and yet don't have a clear understanding of the pickle protocol.

    It is not clear to me what happens when no __reduce__ is implemented and only __getstate__ and __setstate__ are implemented for extension types. If anyone can explain thru' an example it'll really help.

    Thanks!
    See more | Go to post

  • brainstaurm
    started a topic Dictionary comparison?

    Dictionary comparison?

    I would like to understand the internals of the dictionary comparison in python.

    The python reference manual says that:
    "If a class does not define a __cmp__() method it should not define a __hash__() operation either". Why does this dependency exist?

    I tried to google for it, but couldn't find proper documentation. Any pointers will be helpful.

    Thank you!
    See more | Go to post

  • brainstaurm
    replied to Trouble creating bsddb database
    Thanks, printing that out did solve the problem! homeDir was getting set to None when running the script for the first time....
    See more | Go to post

    Leave a comment:


  • brainstaurm
    started a topic Trouble creating bsddb database

    Trouble creating bsddb database

    I am trying to create a bsddb database where I would like to store all the relevant database files created by my application under one directory.

    My code looks as follows:

    Code:
    from bsddb import db
    from os import mkdir
    from os.path import exists
    
    homeDir = 'pidgindb'
    db_env = db.DBEnv()
    db_env.set_cachesize(0, 1024*1024*50)
    if not exists(homeDir):
        homeDir
    ...
    See more | Go to post

  • brainstaurm
    replied to How to pickle dictionaries?
    Thanks for your response! I did try this out....
    See more | Go to post

    Leave a comment:


  • brainstaurm
    replied to How to pickle dictionaries?
    Thanks, your response was useful!

    Could you please point me to the article you wrote, I could not find it....
    See more | Go to post

    Leave a comment:


  • brainstaurm
    started a topic How to pickle dictionaries?

    How to pickle dictionaries?

    I am trying to make some of the in-memory dictionaries in my code persistent using bsddb 4.3. Here is an example dictionary in my code for which I would like to create a persistent version:

    Code:
    # Example dictionary
    patterns = {pat1: {t1:None},
                     pat2: {t1:None, t2:None},
                     pat3: {t2:None}}
    # Each key is an instance of the class T
    # Each value is a dictionary, where
    ...
    See more | Go to post
No activity results to display
Show More
Working...