Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 18th, 2004, 02:42 AM
softking softking is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 6 softking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #2  
Old June 18th, 2004, 03:40 AM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 8
Send a message via MSN to Grim Archon
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
__________________
*** Experimental Python Markup CGI V2 ***

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Solution required


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT