#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    6
    Rep Power
    0

    Solution required


    Hello everybody,
    I have following situation, and would like some suggestions.
    There is one module called TrasnData and another module is ExecuteData.

    Now ExecuteData accepts data as a sequence of { Key,Value } pair. So while calling it (from TransData module) i am creating Sequence and then passing it (to the module ExecuteData).

    Now the problem is i have define those keys such that on the both modules they have same numerical value.

    ExecuteData will access actual values as value = GetData (key).

    In this way i have defined 4200 keys . Obviously it has become huge and unmanageable.

    So i want some solution to achieve the same Key Value thing but without any need to declare them manually.

    Please help me.

    Thanks,
    Vikram Karandikar
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    14
    How are the "values" generated - where do they originally come from.

    Are your key,value pairs in a separate file?

    The external file could be an ordinary text file that both modules read or a python module they both import.

    There is nothing to stop you from using Trandata to write a data module - updating it with new values. But perhaps it would be better to pickle the sequence each time a new value comes in and get Transdata to inform Execute Data that the pickle has changed and that it should redefine it's reference to the sequence.

    You might find my ptypes module useful for this:
    http://www.peck.org.uk/p/python/
    It provides a sequence datatype with built in pickling that emulates lists and dictionaries.

    grim

IMN logo majestic logo threadwatch logo seochat tools logo