[python-win32] Help with data structure

Thomas Hervé therve at neocles.com
Thu Apr 29 09:14:16 EDT 2004


Andy Wilson wrote:

> Hi Folks,

Hi,

> I hope this is the right place to ask this but I would like some 
> advice on appropriate data structures for a data mining application I 
> have. If not the right place, please direct me elsewhere, thanks.
>
Well, I don't think it's really the good place :). comp.lang.python 
should be better.

> type data_type is array (key) of
>     array1
>     array2
>     ...
>     array21
> end type
>  
> where:-
> - key is a combination of four server names,
> - array1 to array21 are lists of floating type values representing 
> timing information.

Not a very "pythonic" way to think. I might do this way :

<code>

class MyData:
    def __init__(self; key1, key2, key3, key4) :
        self.key1 = key1
        ...
        self.key4 = key4
        self.array1 = []
        self.array2 = []
        ...
        self.array21 = []  
    # END __init
# END MyData

ky = (a, b, c, d)
data1 = MyData(ky)

data1.array12.append(foo)

</code>



> /Regards,
> Andy Wilson/
>
> /*CCPS Technical Prime*/
>
> /
> /
>
-- 
Thomas Hervé


More information about the Python-win32 mailing list