RE: Data structure question

2013-11-17 Thread Joseph L. Casale
> How about two dictionaries, each containing the same tuples for > values? If you create a tuple first, then add it to both dicts, you > won't have any space-wasting duplicates. Thanks guys. -- https://mail.python.org/mailman/listinfo/python-list

Re: Data structure question

2013-11-17 Thread Dave Angel
On Mon, 18 Nov 2013 02:03:38 +, "Joseph L. Casale" wrote: I have a need for a script to hold several tuples with three values, two text strings and a lambda. I need to index the tuple based on either of the two strings. Normally a database would be ideal but for a self-contained script

RE: Data structure question

2013-11-17 Thread Joseph L. Casale
> Not entirely sure I understand you, can you post an example? > > If what you mean is that you need to locate the function (lambda) when > you know its corresponding strings, a dict will suit you just fine. > Either maintain two dicts for the two separate strings (eg if they're > "name" and "loca

Re: Data structure question

2013-11-17 Thread Ned Batchelder
On Sunday, November 17, 2013 9:03:38 PM UTC-5, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three values, two text > strings and a lambda. I need to index the tuple based on either of the two > strings. Normally a database would be ideal but for a self-contained

Re: Data structure question

2013-11-17 Thread Chris Angelico
On Mon, Nov 18, 2013 at 1:03 PM, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three values, two text > strings and a lambda. I need to index the tuple based on either of the two > strings. Normally a database would be ideal but for a self-contained script > that

Re: Data structure question

2013-11-17 Thread Tim Chase
On 2013-11-18 02:03, Joseph L. Casale wrote: > I have a need for a script to hold several tuples with three > values, two text strings and a lambda. I need to index the tuple > based on either of the two strings. Normally a database would be > ideal but for a self-contained script that's a bit much